@absolutejs/voice 0.0.22-beta.107 → 0.0.22-beta.109

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.
@@ -0,0 +1,466 @@
1
+ import { Elysia } from 'elysia';
2
+ export type VoiceCampaignStatus = 'canceled' | 'completed' | 'draft' | 'paused' | 'running';
3
+ export type VoiceCampaignRecipientStatus = 'canceled' | 'completed' | 'failed' | 'pending' | 'queued';
4
+ export type VoiceCampaignAttemptStatus = 'canceled' | 'failed' | 'queued' | 'running' | 'succeeded';
5
+ export type VoiceCampaignRecipient = {
6
+ attempts: number;
7
+ completedAt?: number;
8
+ createdAt: number;
9
+ error?: string;
10
+ id: string;
11
+ metadata?: Record<string, unknown>;
12
+ name?: string;
13
+ phone: string;
14
+ status: VoiceCampaignRecipientStatus;
15
+ updatedAt: number;
16
+ variables?: Record<string, string | number | boolean | undefined>;
17
+ };
18
+ export type VoiceCampaignAttempt = {
19
+ campaignId: string;
20
+ completedAt?: number;
21
+ createdAt: number;
22
+ error?: string;
23
+ externalCallId?: string;
24
+ id: string;
25
+ metadata?: Record<string, unknown>;
26
+ recipientId: string;
27
+ startedAt?: number;
28
+ status: VoiceCampaignAttemptStatus;
29
+ updatedAt: number;
30
+ };
31
+ export type VoiceCampaign = {
32
+ createdAt: number;
33
+ description?: string;
34
+ id: string;
35
+ maxAttempts: number;
36
+ maxConcurrentAttempts: number;
37
+ metadata?: Record<string, unknown>;
38
+ name: string;
39
+ status: VoiceCampaignStatus;
40
+ updatedAt: number;
41
+ };
42
+ export type VoiceCampaignRecord = {
43
+ attempts: VoiceCampaignAttempt[];
44
+ campaign: VoiceCampaign;
45
+ recipients: VoiceCampaignRecipient[];
46
+ };
47
+ export type VoiceCampaignStore = {
48
+ get: (id: string) => Promise<VoiceCampaignRecord | undefined> | VoiceCampaignRecord | undefined;
49
+ list: () => Promise<VoiceCampaignRecord[]> | VoiceCampaignRecord[];
50
+ remove: (id: string) => Promise<void> | void;
51
+ set: (id: string, record: VoiceCampaignRecord) => Promise<void> | void;
52
+ };
53
+ export type VoiceCampaignDialerInput = {
54
+ attempt: VoiceCampaignAttempt;
55
+ campaign: VoiceCampaign;
56
+ recipient: VoiceCampaignRecipient;
57
+ };
58
+ export type VoiceCampaignDialerResult = {
59
+ externalCallId?: string;
60
+ metadata?: Record<string, unknown>;
61
+ status?: 'queued' | 'running' | 'succeeded';
62
+ };
63
+ export type VoiceCampaignDialer = (input: VoiceCampaignDialerInput) => Promise<VoiceCampaignDialerResult> | VoiceCampaignDialerResult;
64
+ export type VoiceCampaignCreateInput = {
65
+ description?: string;
66
+ id?: string;
67
+ maxAttempts?: number;
68
+ maxConcurrentAttempts?: number;
69
+ metadata?: Record<string, unknown>;
70
+ name: string;
71
+ };
72
+ export type VoiceCampaignRecipientInput = {
73
+ id?: string;
74
+ metadata?: Record<string, unknown>;
75
+ name?: string;
76
+ phone: string;
77
+ variables?: VoiceCampaignRecipient['variables'];
78
+ };
79
+ export type VoiceCampaignAttemptResultInput = {
80
+ error?: string;
81
+ externalCallId?: string;
82
+ metadata?: Record<string, unknown>;
83
+ status: 'failed' | 'succeeded';
84
+ };
85
+ export type VoiceCampaignTickResult = {
86
+ attempted: number;
87
+ campaignId: string;
88
+ errors: Array<{
89
+ error: string;
90
+ recipientId: string;
91
+ }>;
92
+ started: VoiceCampaignAttempt[];
93
+ };
94
+ export type VoiceCampaignProofOptions = {
95
+ campaign?: VoiceCampaignCreateInput;
96
+ completeAttempts?: boolean;
97
+ recipients?: VoiceCampaignRecipientInput[];
98
+ runtime?: VoiceCampaignRuntime;
99
+ store?: VoiceCampaignStore;
100
+ };
101
+ export type VoiceCampaignProofReport = {
102
+ campaign: VoiceCampaignRecord;
103
+ created: VoiceCampaignRecord;
104
+ final: VoiceCampaignRecord;
105
+ proof: 'voice-campaign';
106
+ recipients: VoiceCampaignRecord;
107
+ summary: VoiceCampaignSummary;
108
+ tick: VoiceCampaignTickResult;
109
+ };
110
+ export type VoiceCampaignSummary = {
111
+ attempts: {
112
+ failed: number;
113
+ queued: number;
114
+ running: number;
115
+ succeeded: number;
116
+ total: number;
117
+ };
118
+ campaigns: {
119
+ canceled: number;
120
+ completed: number;
121
+ draft: number;
122
+ paused: number;
123
+ running: number;
124
+ total: number;
125
+ };
126
+ recipients: {
127
+ canceled: number;
128
+ completed: number;
129
+ failed: number;
130
+ pending: number;
131
+ queued: number;
132
+ total: number;
133
+ };
134
+ };
135
+ export type VoiceCampaignRuntimeOptions = {
136
+ dialer?: VoiceCampaignDialer;
137
+ store: VoiceCampaignStore;
138
+ };
139
+ export type VoiceCampaignRuntime = {
140
+ addRecipients: (campaignId: string, recipients: VoiceCampaignRecipientInput[]) => Promise<VoiceCampaignRecord>;
141
+ cancel: (campaignId: string) => Promise<VoiceCampaignRecord>;
142
+ completeAttempt: (campaignId: string, attemptId: string, result: VoiceCampaignAttemptResultInput) => Promise<VoiceCampaignRecord>;
143
+ create: (input: VoiceCampaignCreateInput) => Promise<VoiceCampaignRecord>;
144
+ enqueue: (campaignId: string) => Promise<VoiceCampaignRecord>;
145
+ get: (campaignId: string) => Promise<VoiceCampaignRecord | undefined>;
146
+ list: () => Promise<VoiceCampaignRecord[]>;
147
+ pause: (campaignId: string) => Promise<VoiceCampaignRecord>;
148
+ remove: (campaignId: string) => Promise<void>;
149
+ resume: (campaignId: string) => Promise<VoiceCampaignRecord>;
150
+ summarize: () => Promise<VoiceCampaignSummary>;
151
+ tick: (campaignId: string) => Promise<VoiceCampaignTickResult>;
152
+ };
153
+ export type VoiceCampaignRoutesOptions = VoiceCampaignRuntimeOptions & {
154
+ headers?: HeadersInit;
155
+ htmlPath?: false | string;
156
+ name?: string;
157
+ path?: string;
158
+ title?: string;
159
+ };
160
+ export declare const createVoiceMemoryCampaignStore: () => VoiceCampaignStore;
161
+ export declare const summarizeVoiceCampaigns: (records: VoiceCampaignRecord[]) => VoiceCampaignSummary;
162
+ export declare const createVoiceCampaign: (options: VoiceCampaignRuntimeOptions) => VoiceCampaignRuntime;
163
+ export declare const runVoiceCampaignProof: (options?: VoiceCampaignProofOptions) => Promise<VoiceCampaignProofReport>;
164
+ export declare const renderVoiceCampaignsHTML: (records: VoiceCampaignRecord[], options?: {
165
+ title?: string;
166
+ }) => string;
167
+ export declare const createVoiceCampaignRoutes: (options: VoiceCampaignRoutesOptions) => Elysia<"", {
168
+ decorator: {};
169
+ store: {};
170
+ derive: {};
171
+ resolve: {};
172
+ }, {
173
+ typebox: {};
174
+ error: {};
175
+ }, {
176
+ schema: {};
177
+ standaloneSchema: {};
178
+ macro: {};
179
+ macroFn: {};
180
+ parser: {};
181
+ response: {};
182
+ }, {
183
+ [x: string]: {
184
+ get: {
185
+ body: unknown;
186
+ params: {};
187
+ query: unknown;
188
+ headers: unknown;
189
+ response: {
190
+ 200: {
191
+ campaigns: VoiceCampaignRecord[];
192
+ summary: VoiceCampaignSummary;
193
+ };
194
+ };
195
+ };
196
+ };
197
+ } & {
198
+ [x: string]: {
199
+ post: {
200
+ body: unknown;
201
+ params: {};
202
+ query: unknown;
203
+ headers: unknown;
204
+ response: {
205
+ 200: VoiceCampaignRecord;
206
+ };
207
+ };
208
+ };
209
+ } & {
210
+ [x: string]: {
211
+ ":campaignId": {
212
+ get: {
213
+ body: unknown;
214
+ params: {
215
+ campaignId: string;
216
+ } & {};
217
+ query: unknown;
218
+ headers: unknown;
219
+ response: {
220
+ 422: {
221
+ type: "validation";
222
+ on: string;
223
+ summary?: string;
224
+ message?: string;
225
+ found?: unknown;
226
+ property?: string;
227
+ expected?: string;
228
+ };
229
+ };
230
+ };
231
+ };
232
+ };
233
+ } & {
234
+ [x: string]: {
235
+ ":campaignId": {
236
+ delete: {
237
+ body: unknown;
238
+ params: {
239
+ campaignId: string;
240
+ } & {};
241
+ query: unknown;
242
+ headers: unknown;
243
+ response: {
244
+ 200: {
245
+ ok: boolean;
246
+ };
247
+ 422: {
248
+ type: "validation";
249
+ on: string;
250
+ summary?: string;
251
+ message?: string;
252
+ found?: unknown;
253
+ property?: string;
254
+ expected?: string;
255
+ };
256
+ };
257
+ };
258
+ };
259
+ };
260
+ } & {
261
+ [x: string]: {
262
+ ":campaignId": {
263
+ recipients: {
264
+ post: {
265
+ body: unknown;
266
+ params: {
267
+ campaignId: string;
268
+ } & {};
269
+ query: unknown;
270
+ headers: unknown;
271
+ response: {
272
+ 200: VoiceCampaignRecord;
273
+ 422: {
274
+ type: "validation";
275
+ on: string;
276
+ summary?: string;
277
+ message?: string;
278
+ found?: unknown;
279
+ property?: string;
280
+ expected?: string;
281
+ };
282
+ };
283
+ };
284
+ };
285
+ };
286
+ };
287
+ } & {
288
+ [x: string]: {
289
+ ":campaignId": {
290
+ enqueue: {
291
+ post: {
292
+ body: unknown;
293
+ params: {
294
+ campaignId: string;
295
+ } & {};
296
+ query: unknown;
297
+ headers: unknown;
298
+ response: {
299
+ 200: VoiceCampaignRecord;
300
+ 422: {
301
+ type: "validation";
302
+ on: string;
303
+ summary?: string;
304
+ message?: string;
305
+ found?: unknown;
306
+ property?: string;
307
+ expected?: string;
308
+ };
309
+ };
310
+ };
311
+ };
312
+ };
313
+ };
314
+ } & {
315
+ [x: string]: {
316
+ ":campaignId": {
317
+ pause: {
318
+ post: {
319
+ body: unknown;
320
+ params: {
321
+ campaignId: string;
322
+ } & {};
323
+ query: unknown;
324
+ headers: unknown;
325
+ response: {
326
+ 200: VoiceCampaignRecord;
327
+ 422: {
328
+ type: "validation";
329
+ on: string;
330
+ summary?: string;
331
+ message?: string;
332
+ found?: unknown;
333
+ property?: string;
334
+ expected?: string;
335
+ };
336
+ };
337
+ };
338
+ };
339
+ };
340
+ };
341
+ } & {
342
+ [x: string]: {
343
+ ":campaignId": {
344
+ resume: {
345
+ post: {
346
+ body: unknown;
347
+ params: {
348
+ campaignId: string;
349
+ } & {};
350
+ query: unknown;
351
+ headers: unknown;
352
+ response: {
353
+ 200: VoiceCampaignRecord;
354
+ 422: {
355
+ type: "validation";
356
+ on: string;
357
+ summary?: string;
358
+ message?: string;
359
+ found?: unknown;
360
+ property?: string;
361
+ expected?: string;
362
+ };
363
+ };
364
+ };
365
+ };
366
+ };
367
+ };
368
+ } & {
369
+ [x: string]: {
370
+ ":campaignId": {
371
+ cancel: {
372
+ post: {
373
+ body: unknown;
374
+ params: {
375
+ campaignId: string;
376
+ } & {};
377
+ query: unknown;
378
+ headers: unknown;
379
+ response: {
380
+ 200: VoiceCampaignRecord;
381
+ 422: {
382
+ type: "validation";
383
+ on: string;
384
+ summary?: string;
385
+ message?: string;
386
+ found?: unknown;
387
+ property?: string;
388
+ expected?: string;
389
+ };
390
+ };
391
+ };
392
+ };
393
+ };
394
+ };
395
+ } & {
396
+ [x: string]: {
397
+ ":campaignId": {
398
+ tick: {
399
+ post: {
400
+ body: unknown;
401
+ params: {
402
+ campaignId: string;
403
+ } & {};
404
+ query: unknown;
405
+ headers: unknown;
406
+ response: {
407
+ 200: VoiceCampaignTickResult;
408
+ 422: {
409
+ type: "validation";
410
+ on: string;
411
+ summary?: string;
412
+ message?: string;
413
+ found?: unknown;
414
+ property?: string;
415
+ expected?: string;
416
+ };
417
+ };
418
+ };
419
+ };
420
+ };
421
+ };
422
+ } & {
423
+ [x: string]: {
424
+ ":campaignId": {
425
+ attempts: {
426
+ ":attemptId": {
427
+ result: {
428
+ post: {
429
+ body: unknown;
430
+ params: {
431
+ campaignId: string;
432
+ attemptId: string;
433
+ } & {};
434
+ query: unknown;
435
+ headers: unknown;
436
+ response: {
437
+ 200: VoiceCampaignRecord;
438
+ 422: {
439
+ type: "validation";
440
+ on: string;
441
+ summary?: string;
442
+ message?: string;
443
+ found?: unknown;
444
+ property?: string;
445
+ expected?: string;
446
+ };
447
+ };
448
+ };
449
+ };
450
+ };
451
+ };
452
+ };
453
+ };
454
+ }, {
455
+ derive: {};
456
+ resolve: {};
457
+ schema: {};
458
+ standaloneSchema: {};
459
+ response: {};
460
+ }, {
461
+ derive: {};
462
+ resolve: {};
463
+ schema: {};
464
+ standaloneSchema: {};
465
+ response: {};
466
+ }>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { voice } from './plugin';
2
2
  export { createVoiceAppKit, createVoiceAppKitRoutes, summarizeVoiceAppKitStatus } from './appKit';
3
+ export { createVoiceCampaign, createVoiceCampaignRoutes, createVoiceMemoryCampaignStore, renderVoiceCampaignsHTML, runVoiceCampaignProof, summarizeVoiceCampaigns } from './campaign';
3
4
  export { createVoiceAssistant, createVoiceExperiment, summarizeVoiceAssistantRuns } from './assistant';
4
5
  export { createVoiceAssistantHealthHTMLHandler, createVoiceAssistantHealthJSONHandler, createVoiceAssistantHealthRoutes, renderVoiceAssistantHealthHTML, summarizeVoiceAssistantHealth } from './assistantHealth';
5
6
  export { createVoiceBargeInRoutes, renderVoiceBargeInHTML, summarizeVoiceBargeIn } from './bargeInRoutes';
@@ -53,6 +54,7 @@ export { resolveVoiceRuntimePreset } from './presets';
53
54
  export { resolveTurnDetectionConfig, TURN_PROFILE_DEFAULTS } from './turnProfiles';
54
55
  export { createVoiceCallReviewFromLiveTelephonyReport, createVoiceCallReviewRecorder, renderVoiceCallReviewHTML, renderVoiceCallReviewMarkdown } from './testing/review';
55
56
  export type { VoiceAppKitLink, VoiceAppKitRoutes, VoiceAppKitRoutesOptions, VoiceAppKitStatus, VoiceAppKitStatusOptions, VoiceAppKitStatusReport, VoiceAppKitSurface } from './appKit';
57
+ export type { VoiceCampaign, VoiceCampaignAttempt, VoiceCampaignAttemptResultInput, VoiceCampaignAttemptStatus, VoiceCampaignCreateInput, VoiceCampaignDialer, VoiceCampaignDialerInput, VoiceCampaignDialerResult, VoiceCampaignProofOptions, VoiceCampaignProofReport, VoiceCampaignRecipient, VoiceCampaignRecipientInput, VoiceCampaignRecipientStatus, VoiceCampaignRecord, VoiceCampaignRoutesOptions, VoiceCampaignRuntime, VoiceCampaignRuntimeOptions, VoiceCampaignStatus, VoiceCampaignStore, VoiceCampaignSummary, VoiceCampaignTickResult } from './campaign';
56
58
  export type { VoiceBargeInReport, VoiceBargeInRoutesOptions } from './bargeInRoutes';
57
59
  export type { VoiceAssistant, VoiceAssistantArtifactPlan, VoiceAssistantExperiment, VoiceAssistantExperimentOptions, VoiceAssistantGuardrailInput, VoiceAssistantGuardrails, VoiceAssistantMemoryLifecycle, VoiceAssistantMemoryLifecycleInput, VoiceAssistantOptions, VoiceAssistantOutputGuardrailInput, VoiceAssistantPreset, VoiceAssistantRunsSummary, VoiceAssistantRunSummary, VoiceAssistantVariant } from './assistant';
58
60
  export type { VoiceAssistantHealthFailure, VoiceAssistantHealthHTMLHandlerOptions, VoiceAssistantHealthRoutesOptions, VoiceAssistantHealthSummary, VoiceAssistantHealthSummaryOptions } from './assistantHealth';