outbound-sdk 0.6.0 → 0.7.1

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 (119) hide show
  1. package/dist/alerts/check-schema.d.ts +1 -1
  2. package/dist/alerts/index.js +6 -6
  3. package/dist/audit/index.js +2 -2
  4. package/dist/benchmarks/index.js +4 -4
  5. package/dist/budget/index.js +2 -2
  6. package/dist/cards/index.js +54 -44
  7. package/dist/chunks/{chunk-BLCJHP5H.js → chunk-45TXPJW7.js} +1 -0
  8. package/dist/chunks/chunk-4AVYRVN5.js +239 -0
  9. package/dist/chunks/{chunk-YYCT3NGV.js → chunk-65YAGEWZ.js} +24 -7
  10. package/dist/chunks/{chunk-3JOC5DGD.js → chunk-6NSCPTOY.js} +488 -127
  11. package/dist/chunks/{chunk-W22SDX6S.js → chunk-7I3EPR23.js} +3 -3
  12. package/dist/chunks/{chunk-MGR6HREO.js → chunk-BNDHEDHD.js} +2 -2
  13. package/dist/chunks/chunk-DNPNTD5W.js +81 -0
  14. package/dist/chunks/{chunk-53DCVFUB.js → chunk-FALWG5U3.js} +1 -0
  15. package/dist/chunks/{chunk-OLPMBRXM.js → chunk-GL7BABF2.js} +2 -2
  16. package/dist/chunks/{chunk-ZOAG2C6V.js → chunk-HIAK2GCI.js} +9 -2
  17. package/dist/chunks/{chunk-SXGCKCAR.js → chunk-I7DXXGNZ.js} +40 -9
  18. package/dist/chunks/{chunk-BK5SLY32.js → chunk-JRL3QRBS.js} +264 -76
  19. package/dist/chunks/{chunk-PHNQ3WC2.js → chunk-KTYTE2BU.js} +4 -3
  20. package/dist/chunks/{chunk-JWGSB7PT.js → chunk-LD6F46UT.js} +2 -2
  21. package/dist/chunks/{chunk-2D42TQFU.js → chunk-LVZGIKNF.js} +2 -2
  22. package/dist/chunks/{chunk-PQSTQKRD.js → chunk-M2VXGLLZ.js} +35 -2
  23. package/dist/chunks/{chunk-UWUPUMM2.js → chunk-MW4C6LTN.js} +2 -2
  24. package/dist/chunks/chunk-OK3GAZMT.js +51 -0
  25. package/dist/chunks/{chunk-BOWXGMN3.js → chunk-POBAY3TI.js} +80 -4
  26. package/dist/chunks/{chunk-J7DDZ4C2.js → chunk-QFC4ZHD3.js} +1 -1
  27. package/dist/chunks/{chunk-TFICTGM2.js → chunk-T5MJMW3R.js} +1 -1
  28. package/dist/chunks/{chunk-GFDNRWR3.js → chunk-UFQ4WMLU.js} +1 -1
  29. package/dist/chunks/{chunk-QAKJ76HB.js → chunk-YW6FFVSZ.js} +1 -1
  30. package/dist/cli/bin.js +14 -14
  31. package/dist/cli/by-name.d.ts +28 -0
  32. package/dist/cli/commands.d.ts +2 -1
  33. package/dist/cli/config.d.ts +3 -2
  34. package/dist/cli/envelope.d.ts +50 -0
  35. package/dist/cli/index.d.ts +5 -0
  36. package/dist/cli/index.js +13 -13
  37. package/dist/cli/listing.d.ts +13 -0
  38. package/dist/cli/native.d.ts +4 -0
  39. package/dist/cli/options.d.ts +88 -0
  40. package/dist/cli/output.d.ts +13 -1
  41. package/dist/cli/suggest.d.ts +10 -0
  42. package/dist/cli/update.d.ts +25 -2
  43. package/dist/clients/index.js +6 -6
  44. package/dist/combine/index.js +7 -7
  45. package/dist/emailbison/capabilities.d.ts +1 -0
  46. package/dist/emailbison/index.js +38 -14
  47. package/dist/emailbison/map-stats.d.ts +10 -0
  48. package/dist/exporter/index.js +2 -2
  49. package/dist/failover/index.js +2 -2
  50. package/dist/fixtures/index.js +4 -4
  51. package/dist/heyreach/capabilities.d.ts +3 -0
  52. package/dist/heyreach/index.js +34 -12
  53. package/dist/heyreach/map-account.d.ts +2 -2
  54. package/dist/identity/index.js +2 -2
  55. package/dist/index.js +9 -7
  56. package/dist/insights/copy/audit-samples.d.ts +24 -0
  57. package/dist/insights/copy/audit-variant.d.ts +34 -0
  58. package/dist/insights/copy/copy-audit.d.ts +26 -12
  59. package/dist/insights/copy/copy-preview.d.ts +16 -3
  60. package/dist/insights/copy/index.d.ts +6 -0
  61. package/dist/insights/copy/reply-timing.d.ts +4 -0
  62. package/dist/insights/copy/shared.d.ts +4 -1
  63. package/dist/insights/copy/step-funnel.d.ts +20 -6
  64. package/dist/insights/copy/variant-test.d.ts +2 -3
  65. package/dist/insights/index.js +1138 -589
  66. package/dist/insights/inputs.generated.d.ts +47 -11
  67. package/dist/insights/ops/campaign-diagnosis.d.ts +2 -0
  68. package/dist/insights/ops/diagnosis-checks.d.ts +20 -1
  69. package/dist/insights/ops/index.d.ts +2 -0
  70. package/dist/insights/ops/pipeline-forecast.d.ts +17 -6
  71. package/dist/insights/people/account-summary.d.ts +14 -1
  72. package/dist/insights/people/auto-replies.d.ts +14 -0
  73. package/dist/insights/people/dropped-replies.d.ts +1 -1
  74. package/dist/insights/people/hot-leads.d.ts +5 -1
  75. package/dist/insights/people/index.d.ts +4 -0
  76. package/dist/insights/people/lead-collisions.d.ts +11 -2
  77. package/dist/insights/people/person-summary.d.ts +19 -3
  78. package/dist/insights/people/personalization-gaps.d.ts +14 -8
  79. package/dist/insights/people/suppression-check.d.ts +9 -0
  80. package/dist/insights/registry.d.ts +12 -0
  81. package/dist/insights/step.d.ts +15 -0
  82. package/dist/insights/variables.d.ts +2 -0
  83. package/dist/instantly/capabilities.d.ts +4 -0
  84. package/dist/instantly/index.js +263 -53
  85. package/dist/instantly/map-stats.d.ts +4 -0
  86. package/dist/instantly/stats-tracking.d.ts +19 -0
  87. package/dist/instantly/thread.d.ts +9 -0
  88. package/dist/internal/adapter.d.ts +5 -0
  89. package/dist/internal/auto-reply.d.ts +20 -0
  90. package/dist/internal/capabilities.d.ts +2 -0
  91. package/dist/internal/entities-account.d.ts +1 -0
  92. package/dist/internal/entities.d.ts +79 -2
  93. package/dist/internal/fields.d.ts +37 -1
  94. package/dist/internal/metrics.d.ts +23 -1
  95. package/dist/internal/outbound/api.d.ts +2 -0
  96. package/dist/internal/records.d.ts +2 -2
  97. package/dist/internal/reply-people.d.ts +37 -0
  98. package/dist/internal/runway.d.ts +42 -0
  99. package/dist/internal/sender-screen.d.ts +9 -0
  100. package/dist/internal/tracking.d.ts +33 -0
  101. package/dist/loader/index.js +4 -4
  102. package/dist/memory/data.d.ts +2 -1
  103. package/dist/memory/index.js +23 -12
  104. package/dist/redact/index.js +3 -3
  105. package/dist/smartlead/capabilities.d.ts +4 -0
  106. package/dist/smartlead/index.js +152 -38
  107. package/dist/smartlead/map-account.d.ts +3 -0
  108. package/dist/smartlead/stats-tracking.d.ts +22 -0
  109. package/dist/sync/index.js +2 -2
  110. package/dist/tools/ai-sdk.js +8 -7
  111. package/dist/tools/by-name.d.ts +18 -0
  112. package/dist/tools/campaign-tools.d.ts +6 -2
  113. package/dist/tools/claude-agent.js +8 -7
  114. package/dist/tools/index.js +9 -8
  115. package/dist/tools/shared.d.ts +7 -0
  116. package/dist/tracing/index.js +2 -2
  117. package/dist/webhooks/index.js +12 -11
  118. package/package.json +1 -1
  119. package/dist/chunks/chunk-HWHI4LFY.js +0 -102
@@ -0,0 +1,20 @@
1
+ /** What a received email says about itself. Any field may be unknown. */
2
+ export interface AutoReplyInput {
3
+ /** The address the reply came from. */
4
+ readonly from: string | null;
5
+ readonly subject: string | null;
6
+ /** The body, HTML or plain text, quoted history included or not. */
7
+ readonly body: string | null;
8
+ }
9
+ export interface AutoReplyVerdict {
10
+ /** `true` when a rule matched. */
11
+ readonly isAuto: boolean;
12
+ /** `true` when the reply says the person left the company or the contact changed. */
13
+ readonly leftCompany: boolean;
14
+ }
15
+ /** Under this many milliseconds after the message it answers, no person wrote the reply. */
16
+ export declare const AUTO_REPLY_WITHIN_MS = 60000;
17
+ /** Reads a received email by the fixed rules above. */
18
+ export declare const detectAutoReply: (input: AutoReplyInput) => AutoReplyVerdict;
19
+ /** `true` when a reply came so soon after the message it answers that no person wrote it. */
20
+ export declare const answeredAtOnce: (sentAt: string | null, repliedAt: string | null) => boolean;
@@ -31,6 +31,8 @@ export interface Capabilities {
31
31
  "leads.since": FilterGrade;
32
32
  /** Find a lead by its exact email address or LinkedIn profile, without walking every lead. */
33
33
  "leads.lookup": boolean;
34
+ /** Find the leads whose email address is at one domain, without walking every lead. */
35
+ "leads.byDomain": boolean;
34
36
  /** Leads carry open, click and reply counts. */
35
37
  "leads.engagement": boolean;
36
38
  /** List the saved lead lists. */
@@ -51,6 +51,7 @@ export declare const campaignProgressSchema: z.ZodObject<{
51
51
  inProgress: z.ZodNullable<z.ZodNumber>;
52
52
  leads: z.ZodNullable<z.ZodNumber>;
53
53
  notStarted: z.ZodNullable<z.ZodNumber>;
54
+ skipped: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
54
55
  stopped: z.ZodNullable<z.ZodNumber>;
55
56
  provider: z.ZodString;
56
57
  raw: z.ZodJSONSchema;
@@ -106,6 +106,13 @@ export declare const mailProviderSchema: z.ZodEnum<{
106
106
  smtp: "smtp";
107
107
  }>;
108
108
  export type MailProvider = z.infer<typeof mailProviderSchema>;
109
+ /** Who hosts a lead's own mailbox, the one the campaign sends to. */
110
+ export declare const recipientMailProviderSchema: z.ZodEnum<{
111
+ google: "google";
112
+ microsoft: "microsoft";
113
+ other: "other";
114
+ }>;
115
+ export type RecipientMailProvider = z.infer<typeof recipientMailProviderSchema>;
109
116
  export declare const senderSchema: z.ZodObject<{
110
117
  address: z.ZodNullable<z.ZodString>;
111
118
  dailyLimit: z.ZodNullable<z.ZodNumber>;
@@ -149,15 +156,21 @@ export declare const leadStatusSchema: z.ZodEnum<{
149
156
  unknown: "unknown";
150
157
  bounced: "bounced";
151
158
  replied: "replied";
159
+ skipped: "skipped";
152
160
  unsubscribed: "unsubscribed";
153
161
  }>;
154
162
  export type LeadStatus = z.infer<typeof leadStatusSchema>;
155
- /** Where a lead is in its sequence, whatever came back from it. */
163
+ /**
164
+ * Where a lead is in its sequence, whatever came back from it. `skipped` is a
165
+ * lead the vendor decided never to send to, for example a duplicate or one
166
+ * over a domain limit: it is not waiting to start.
167
+ */
156
168
  export declare const leadProgressSchema: z.ZodEnum<{
157
169
  active: "active";
158
170
  completed: "completed";
159
171
  paused: "paused";
160
172
  unknown: "unknown";
173
+ skipped: "skipped";
161
174
  }>;
162
175
  export type LeadProgress = z.infer<typeof leadProgressSchema>;
163
176
  /** What a lead did with the campaign's messages, as the vendor counts it. */
@@ -210,7 +223,13 @@ export declare const leadSchema: z.ZodObject<{
210
223
  completed: "completed";
211
224
  paused: "paused";
212
225
  unknown: "unknown";
226
+ skipped: "skipped";
213
227
  }>;
228
+ recipientMailProvider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
229
+ google: "google";
230
+ microsoft: "microsoft";
231
+ other: "other";
232
+ }>>>;
214
233
  replied: z.ZodNullable<z.ZodBoolean>;
215
234
  status: z.ZodEnum<{
216
235
  active: "active";
@@ -219,6 +238,7 @@ export declare const leadSchema: z.ZodObject<{
219
238
  unknown: "unknown";
220
239
  bounced: "bounced";
221
240
  replied: "replied";
241
+ skipped: "skipped";
222
242
  unsubscribed: "unsubscribed";
223
243
  }>;
224
244
  tags: z.ZodArray<z.ZodString>;
@@ -233,11 +253,22 @@ export declare const leadSchema: z.ZodObject<{
233
253
  workspaceId: z.ZodString;
234
254
  }, z.core.$strip>;
235
255
  export type Lead = z.infer<typeof leadSchema>;
256
+ /** Who decided `isAuto`: the vendor's own flag, or a fixed rule. */
257
+ export declare const autoSourceSchema: z.ZodEnum<{
258
+ vendor: "vendor";
259
+ rule: "rule";
260
+ }>;
261
+ export type AutoSource = z.infer<typeof autoSourceSchema>;
236
262
  export declare const messageSchema: z.ZodObject<{
237
263
  direction: z.ZodEnum<{
238
264
  out: "out";
239
265
  in: "in";
240
266
  }>;
267
+ isAuto: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
268
+ isAutoSource: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
269
+ vendor: "vendor";
270
+ rule: "rule";
271
+ }>>>;
241
272
  bodyHtml: z.ZodNullable<z.ZodString>;
242
273
  bodyText: z.ZodNullable<z.ZodString>;
243
274
  campaignRef: z.ZodNullable<z.ZodString>;
@@ -260,6 +291,10 @@ export declare const messageSchema: z.ZodObject<{
260
291
  workspaceId: z.ZodString;
261
292
  }, z.core.$strip>;
262
293
  export type Message = z.infer<typeof messageSchema>;
294
+ /**
295
+ * One received message, not one person: a lead who replies twice in a thread
296
+ * is two replies. Count people by `leadRef`, as `MetricRow.replied` does.
297
+ */
263
298
  export declare const replySchema: z.ZodObject<{
264
299
  category: z.ZodEnum<{
265
300
  unknown: "unknown";
@@ -272,11 +307,16 @@ export declare const replySchema: z.ZodObject<{
272
307
  }>;
273
308
  categorySource: z.ZodNullable<z.ZodEnum<{
274
309
  vendor: "vendor";
275
- lead: "lead";
276
310
  rule: "rule";
311
+ lead: "lead";
277
312
  }>>;
278
313
  direction: z.ZodLiteral<"in">;
279
314
  isAuto: z.ZodNullable<z.ZodBoolean>;
315
+ isAutoSource: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
316
+ vendor: "vendor";
317
+ rule: "rule";
318
+ }>>>;
319
+ leftCompany: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
280
320
  unread: z.ZodNullable<z.ZodBoolean>;
281
321
  bodyHtml: z.ZodNullable<z.ZodString>;
282
322
  bodyText: z.ZodNullable<z.ZodString>;
@@ -313,6 +353,25 @@ export declare const evidenceSchema: z.ZodEnum<{
313
353
  sampled: "sampled";
314
354
  }>;
315
355
  export type Evidence = z.infer<typeof evidenceSchema>;
356
+ export declare const trackingStateSchema: z.ZodNullable<z.ZodEnum<{
357
+ mixed: "mixed";
358
+ off: "off";
359
+ on: "on";
360
+ }>>;
361
+ export type TrackingState = z.infer<typeof trackingStateSchema>;
362
+ declare const trackingSchema: z.ZodObject<{
363
+ clicks: z.ZodNullable<z.ZodEnum<{
364
+ mixed: "mixed";
365
+ off: "off";
366
+ on: "on";
367
+ }>>;
368
+ opens: z.ZodNullable<z.ZodEnum<{
369
+ mixed: "mixed";
370
+ off: "off";
371
+ on: "on";
372
+ }>>;
373
+ }, z.core.$strip>;
374
+ export type MetricTracking = z.infer<typeof trackingSchema>;
316
375
  /**
317
376
  * Counts only. Rates are computed from these in `metrics.ts`, so every
318
377
  * adapter and plugin agrees on what a reply rate is.
@@ -323,6 +382,7 @@ export declare const metricRowSchema: z.ZodObject<{
323
382
  clickedTotal: z.ZodNullable<z.ZodNumber>;
324
383
  connectionsAccepted: z.ZodNullable<z.ZodNumber>;
325
384
  connectionsSent: z.ZodNullable<z.ZodNumber>;
385
+ completed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
326
386
  contacted: z.ZodNullable<z.ZodNumber>;
327
387
  contentHash: z.ZodNullable<z.ZodString>;
328
388
  date: z.ZodNullable<z.ZodISODate>;
@@ -333,12 +393,17 @@ export declare const metricRowSchema: z.ZodObject<{
333
393
  sampled: "sampled";
334
394
  }>;
335
395
  inmailsSent: z.ZodNullable<z.ZodNumber>;
396
+ leads: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
336
397
  opened: z.ZodNullable<z.ZodNumber>;
337
398
  openedTotal: z.ZodNullable<z.ZodNumber>;
399
+ opportunities: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
400
+ opportunityValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
338
401
  positive: z.ZodNullable<z.ZodNumber>;
339
402
  provider: z.ZodString;
340
403
  replied: z.ZodNullable<z.ZodNumber>;
341
404
  repliedAuto: z.ZodNullable<z.ZodNumber>;
405
+ repliedAutoTotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
406
+ repliedTotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
342
407
  schemaVersion: z.ZodLiteral<1>;
343
408
  scope: z.ZodEnum<{
344
409
  campaign: "campaign";
@@ -350,6 +415,18 @@ export declare const metricRowSchema: z.ZodObject<{
350
415
  sent: z.ZodNullable<z.ZodNumber>;
351
416
  stepIndex: z.ZodNullable<z.ZodNumber>;
352
417
  timezone: z.ZodNullable<z.ZodString>;
418
+ tracking: z.ZodOptional<z.ZodObject<{
419
+ clicks: z.ZodNullable<z.ZodEnum<{
420
+ mixed: "mixed";
421
+ off: "off";
422
+ on: "on";
423
+ }>>;
424
+ opens: z.ZodNullable<z.ZodEnum<{
425
+ mixed: "mixed";
426
+ off: "off";
427
+ on: "on";
428
+ }>>;
429
+ }, z.core.$strip>>;
353
430
  unsubscribed: z.ZodNullable<z.ZodNumber>;
354
431
  variantKey: z.ZodNullable<z.ZodString>;
355
432
  workspaceId: z.ZodString;
@@ -49,6 +49,7 @@ export declare const RECORD_SCHEMAS: {
49
49
  inProgress: z.ZodNullable<z.ZodNumber>;
50
50
  leads: z.ZodNullable<z.ZodNumber>;
51
51
  notStarted: z.ZodNullable<z.ZodNumber>;
52
+ skipped: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
52
53
  stopped: z.ZodNullable<z.ZodNumber>;
53
54
  provider: z.ZodString;
54
55
  raw: z.ZodJSONSchema;
@@ -123,7 +124,13 @@ export declare const RECORD_SCHEMAS: {
123
124
  completed: "completed";
124
125
  paused: "paused";
125
126
  unknown: "unknown";
127
+ skipped: "skipped";
126
128
  }>;
129
+ recipientMailProvider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
130
+ google: "google";
131
+ microsoft: "microsoft";
132
+ other: "other";
133
+ }>>>;
127
134
  replied: z.ZodNullable<z.ZodBoolean>;
128
135
  status: z.ZodEnum<{
129
136
  active: "active";
@@ -132,6 +139,7 @@ export declare const RECORD_SCHEMAS: {
132
139
  unknown: "unknown";
133
140
  bounced: "bounced";
134
141
  replied: "replied";
142
+ skipped: "skipped";
135
143
  unsubscribed: "unsubscribed";
136
144
  }>;
137
145
  tags: z.ZodArray<z.ZodString>;
@@ -165,6 +173,11 @@ export declare const RECORD_SCHEMAS: {
165
173
  out: "out";
166
174
  in: "in";
167
175
  }>;
176
+ isAuto: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
177
+ isAutoSource: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
178
+ vendor: "vendor";
179
+ rule: "rule";
180
+ }>>>;
168
181
  bodyHtml: z.ZodNullable<z.ZodString>;
169
182
  bodyText: z.ZodNullable<z.ZodString>;
170
183
  campaignRef: z.ZodNullable<z.ZodString>;
@@ -192,6 +205,7 @@ export declare const RECORD_SCHEMAS: {
192
205
  clickedTotal: z.ZodNullable<z.ZodNumber>;
193
206
  connectionsAccepted: z.ZodNullable<z.ZodNumber>;
194
207
  connectionsSent: z.ZodNullable<z.ZodNumber>;
208
+ completed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
195
209
  contacted: z.ZodNullable<z.ZodNumber>;
196
210
  contentHash: z.ZodNullable<z.ZodString>;
197
211
  date: z.ZodNullable<z.ZodISODate>;
@@ -202,12 +216,17 @@ export declare const RECORD_SCHEMAS: {
202
216
  sampled: "sampled";
203
217
  }>;
204
218
  inmailsSent: z.ZodNullable<z.ZodNumber>;
219
+ leads: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
205
220
  opened: z.ZodNullable<z.ZodNumber>;
206
221
  openedTotal: z.ZodNullable<z.ZodNumber>;
222
+ opportunities: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
223
+ opportunityValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
207
224
  positive: z.ZodNullable<z.ZodNumber>;
208
225
  provider: z.ZodString;
209
226
  replied: z.ZodNullable<z.ZodNumber>;
210
227
  repliedAuto: z.ZodNullable<z.ZodNumber>;
228
+ repliedAutoTotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
229
+ repliedTotal: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
211
230
  schemaVersion: z.ZodLiteral<1>;
212
231
  scope: z.ZodEnum<{
213
232
  campaign: "campaign";
@@ -219,6 +238,18 @@ export declare const RECORD_SCHEMAS: {
219
238
  sent: z.ZodNullable<z.ZodNumber>;
220
239
  stepIndex: z.ZodNullable<z.ZodNumber>;
221
240
  timezone: z.ZodNullable<z.ZodString>;
241
+ tracking: z.ZodOptional<z.ZodObject<{
242
+ clicks: z.ZodNullable<z.ZodEnum<{
243
+ mixed: "mixed";
244
+ off: "off";
245
+ on: "on";
246
+ }>>;
247
+ opens: z.ZodNullable<z.ZodEnum<{
248
+ mixed: "mixed";
249
+ off: "off";
250
+ on: "on";
251
+ }>>;
252
+ }, z.core.$strip>>;
222
253
  unsubscribed: z.ZodNullable<z.ZodNumber>;
223
254
  variantKey: z.ZodNullable<z.ZodString>;
224
255
  workspaceId: z.ZodString;
@@ -259,11 +290,16 @@ export declare const RECORD_SCHEMAS: {
259
290
  }>;
260
291
  categorySource: z.ZodNullable<z.ZodEnum<{
261
292
  vendor: "vendor";
262
- lead: "lead";
263
293
  rule: "rule";
294
+ lead: "lead";
264
295
  }>>;
265
296
  direction: z.ZodLiteral<"in">;
266
297
  isAuto: z.ZodNullable<z.ZodBoolean>;
298
+ isAutoSource: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
299
+ vendor: "vendor";
300
+ rule: "rule";
301
+ }>>>;
302
+ leftCompany: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
267
303
  unread: z.ZodNullable<z.ZodBoolean>;
268
304
  bodyHtml: z.ZodNullable<z.ZodString>;
269
305
  bodyText: z.ZodNullable<z.ZodString>;
@@ -40,7 +40,22 @@ export interface Rate {
40
40
  }
41
41
  /** Computes every rate for one row of counts. */
42
42
  export declare const computeRates: (row: MetricRow) => Record<MetricName, Rate>;
43
- declare const COUNT_KEYS: readonly ["bounced", "clicked", "clickedTotal", "connectionsAccepted", "connectionsSent", "contacted", "delivered", "inmailsSent", "opened", "openedTotal", "positive", "replied", "repliedAuto", "sent", "unsubscribed"];
43
+ /**
44
+ * How many times a campaign's leads its count of leads contacted may be
45
+ * before the count reads as a fault. Leads removed after their sequence
46
+ * started stay in `contacted`, so it can pass `leads` on correct data (seen
47
+ * live: 430 started against 383 leads). A count that also takes in each step
48
+ * a lead reaches is several times the leads (1,404 against 383 on a
49
+ * four-step campaign). Two times sits between the two.
50
+ */
51
+ export declare const CONTACTED_LEADS_LIMIT = 2;
52
+ /**
53
+ * `true` when `contacted` is more than `CONTACTED_LEADS_LIMIT` times `leads`,
54
+ * which means the count of leads contacted is not what it says. `false` when
55
+ * either is unknown or the campaign has no leads to compare with.
56
+ */
57
+ export declare const contactedBeyondLeads: (contacted: number | null, leads: number | null | undefined) => boolean;
58
+ declare const COUNT_KEYS: readonly ["bounced", "clicked", "clickedTotal", "completed", "connectionsAccepted", "connectionsSent", "contacted", "delivered", "inmailsSent", "leads", "opened", "openedTotal", "opportunities", "opportunityValue", "positive", "replied", "repliedAuto", "repliedAutoTotal", "repliedTotal", "sent", "unsubscribed"];
44
59
  export type MetricCounts = Pick<MetricRow, (typeof COUNT_KEYS)[number]>;
45
60
  /** A row of counts with every value unknown. */
46
61
  export declare const emptyCounts: () => MetricCounts;
@@ -50,6 +65,13 @@ export declare const emptyCounts: () => MetricCounts;
50
65
  * are summed, which over-counts people who appear in more than one row.
51
66
  */
52
67
  export declare const sumCounts: (rows: readonly MetricCounts[]) => MetricCounts;
68
+ /**
69
+ * `sumCounts` for a rollup that is read as one total. An open or click count
70
+ * is `null` when any row that sent mail has it `null`: that row did not
71
+ * measure it, so adding up the others would understate the rate without
72
+ * saying so. Internal: the public `sumCounts` keeps every count it can.
73
+ */
74
+ export declare const sumMeasured: (rows: readonly MetricCounts[]) => MetricCounts;
53
75
  /** What a row of counts is for: a workspace, a campaign, a step or a sender. */
54
76
  export interface RowScope extends Identity {
55
77
  readonly scope: MetricScope;
@@ -100,6 +100,8 @@ export interface LeadFilters extends TimeRange {
100
100
  readonly email?: string | undefined;
101
101
  /** Only the records of the person with exactly this LinkedIn profile. */
102
102
  readonly linkedinUrl?: string | undefined;
103
+ /** Only the records whose email address is at exactly this domain, such as `acme.com`. Needs `leads.byDomain`. */
104
+ readonly domain?: string | undefined;
103
105
  }
104
106
  export interface WebhookFilters {
105
107
  readonly campaignId?: string | undefined;
@@ -1,5 +1,5 @@
1
- export { campaignSchema, campaignStatusSchema, channelSchema, eventDataSchema, eventTypeSchema, evidenceSchema, leadProgressSchema, leadSchema, leadStatusSchema, mailProviderSchema, messageSchema, metricRowSchema, metricScopeSchema, outboundEventSchema, replyCategorySchema, replySchema, SCHEMA_VERSION, senderSchema, senderStatusSchema, sequenceSchema, workspaceSchema, } from "./entities.ts";
2
- export type { Campaign, CampaignStatus, Channel, EventData, EventType, Evidence, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, MetricScope, OutboundEvent, Reply, ReplyCategory, Sender, SenderStatus, Sequence, SequenceStep, SequenceVariant, Workspace, } from "./entities.ts";
1
+ export { campaignSchema, campaignStatusSchema, channelSchema, eventDataSchema, eventTypeSchema, evidenceSchema, leadProgressSchema, leadSchema, leadStatusSchema, mailProviderSchema, messageSchema, metricRowSchema, metricScopeSchema, outboundEventSchema, recipientMailProviderSchema, replyCategorySchema, replySchema, SCHEMA_VERSION, senderSchema, senderStatusSchema, sequenceSchema, workspaceSchema, } from "./entities.ts";
2
+ export type { Campaign, CampaignStatus, Channel, EventData, EventType, Evidence, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, MetricScope, OutboundEvent, RecipientMailProvider, Reply, ReplyCategory, Sender, SenderStatus, Sequence, SequenceStep, SequenceVariant, Workspace, } from "./entities.ts";
3
3
  export { blockEntrySchema, campaignProgressSchema, campaignSettingsSchema, leadListSchema, placementTestSchema, senderHealthSchema, tagSchema, webhookSubscriptionSchema, } from "./entities-account.ts";
4
4
  export type { BlockEntry, CampaignProgress, CampaignSettings, Entity, LeadList, PlacementTest, SenderHealth, SendingWindow, Tag, WebhookSubscription, } from "./entities-account.ts";
5
5
  export { resolveFields } from "./fields.ts";
@@ -0,0 +1,37 @@
1
+ import type { Reply, ReplyCategory } from "./entities.ts";
2
+ type Counted = Pick<Reply, "leadRef" | "threadId">;
3
+ export interface ReplyCounts {
4
+ /** Reply messages. */
5
+ readonly messages: number;
6
+ /** Distinct `leadRef`s. `null` when any reply has no `leadRef`. */
7
+ readonly people: number | null;
8
+ /** Distinct `threadId`s. `null` when any reply has no `threadId`. */
9
+ readonly threads: number | null;
10
+ }
11
+ /** How many messages, people and threads a list of replies holds. */
12
+ export declare const countReplies: (replies: readonly Counted[]) => ReplyCounts;
13
+ /** `40 messages from 21 people in 9 threads`, leaving out what is unknown. */
14
+ export declare const describeReplyCounts: (counts: ReplyCounts) => string;
15
+ /** One person's replies, from `repliesByPerson`. */
16
+ export interface ReplyPerson {
17
+ /**
18
+ * The lead who sent them. `null` for replies with no lead: those are
19
+ * grouped by thread instead, one row per thread.
20
+ */
21
+ readonly leadRef: string | null;
22
+ readonly messages: number;
23
+ /** The earliest and latest `sentAt`. `null` when no reply has one. */
24
+ readonly firstAt: string | null;
25
+ readonly lastAt: string | null;
26
+ /** Each category the replies carry, in the order first seen. */
27
+ readonly categories: readonly ReplyCategory[];
28
+ /** Each thread the replies are in, in the order first seen. */
29
+ readonly threadIds: readonly string[];
30
+ }
31
+ type Grouped = Pick<Reply, "category" | "leadRef" | "sentAt" | "threadId">;
32
+ /**
33
+ * One row per person, in the order each person first appears. A reply with
34
+ * no `leadRef` is grouped by its thread, or stands alone without one.
35
+ */
36
+ export declare const repliesByPerson: (replies: readonly Grouped[]) => ReplyPerson[];
37
+ export {};
@@ -0,0 +1,42 @@
1
+ import type { Lead, LeadStatus } from "./entities.ts";
2
+ /** Inclusive `YYYY-MM-DD` days. */
3
+ export interface PaceWindow {
4
+ readonly from: string;
5
+ readonly to: string;
6
+ }
7
+ /** The `days` complete UTC days that end yesterday; today is not over. */
8
+ export declare const paceWindow: (now: number, days: number) => PaceWindow;
9
+ /**
10
+ * New leads started per day: the known daily `contacted` counts added up and
11
+ * divided by `days`. A day with no row counts as none started. `null` when no
12
+ * row reports `contacted`.
13
+ */
14
+ export declare const newLeadsPerDay: (rows: readonly {
15
+ readonly contacted: number | null;
16
+ }[], days: number) => number | null;
17
+ /** The active leads, split by whether their sequence has started. */
18
+ export interface ActiveSplit {
19
+ readonly active: number;
20
+ /**
21
+ * Active leads with no step sent and no contact yet. `null` when the vendor
22
+ * reports neither for any lead read, so started and unstarted look alike.
23
+ */
24
+ readonly notStarted: number | null;
25
+ /** Active leads with a step sent or a contact time. `null` with `notStarted`. */
26
+ readonly inSequence: number | null;
27
+ }
28
+ /**
29
+ * Splits the active leads. A vendor that reports a lead's last step or last
30
+ * contact reports it on some lead once the campaign has sent, so when no lead
31
+ * read has either, the split is unknown rather than "none started".
32
+ */
33
+ export declare const splitActive: (leads: readonly Lead[]) => ActiveSplit;
34
+ /** The leads runway divides: those not yet started, or every active lead when the split is unknown. */
35
+ export declare const leadsToStart: (split: ActiveSplit) => number;
36
+ /**
37
+ * Days until no lead is left to start: `leadsToStart` divided by the pace.
38
+ * `0` when every lead was read, none has an unknown status and none is left
39
+ * to start. `null` when the count is unknown (`complete` false, or a lead's
40
+ * status unknown) and none was found, or when some are left with no pace.
41
+ */
42
+ export declare const runwayDays: (split: ActiveSplit, byStatus: Readonly<Pick<Record<LeadStatus, number>, "unknown">>, complete: boolean, pace: number | null) => number | null;
@@ -0,0 +1,9 @@
1
+ import type { Sender } from "./entities.ts";
2
+ /** Every sender up to this many is screened from the sender list. Past it, the screen is partial. */
3
+ export declare const SCREENED_AT_MOST = 500;
4
+ /** The vendor reports the sender disconnected or failing. */
5
+ export declare const brokenStatus: (sender: Sender) => boolean;
6
+ /** The vendor reports a warmup score of exactly 0. An unreported score is not 0. */
7
+ export declare const warmupAtZero: (sender: Sender) => boolean;
8
+ /** The problems the sender list shows, in plain words. Empty when it shows none. */
9
+ export declare const listProblemsOf: (sender: Sender) => string[];
@@ -0,0 +1,33 @@
1
+ import type { MetricRow } from "./entities.ts";
2
+ /** A campaign's tracking settings as the vendor reports them now. */
3
+ export interface TrackingFlags {
4
+ readonly clicks: boolean | null;
5
+ readonly opens: boolean | null;
6
+ }
7
+ /** One campaign behind a row: its settings and what it recorded in the range. */
8
+ export interface CampaignTracking {
9
+ readonly flags: TrackingFlags;
10
+ /** Messages sent in the range. A campaign that sent nothing is left out. */
11
+ readonly sent: number | null;
12
+ /** Opens recorded in the range, unique or total. */
13
+ readonly opened: number | null;
14
+ /** Clicks recorded in the range, unique or total. */
15
+ readonly clicked: number | null;
16
+ }
17
+ /**
18
+ * One campaign's part in its own rows (an overview, its days or its steps):
19
+ * what those rows recorded over the range.
20
+ */
21
+ export declare const ownTracking: (flags: TrackingFlags, rows: readonly MetricRow[]) => CampaignTracking;
22
+ /**
23
+ * Sets each row's `tracking` and makes the counts the campaigns did not
24
+ * measure `null`. `null` campaigns (the settings could not be read) leave the
25
+ * rows unchanged.
26
+ */
27
+ export declare const applyTracking: (rows: readonly MetricRow[], campaigns: readonly CampaignTracking[] | null) => MetricRow[];
28
+ /**
29
+ * Runs a read of tracking settings. A vendor error gives `null`, which
30
+ * leaves the counts as they are: the stats themselves were read, and a
31
+ * failed extra read should not cost the caller them.
32
+ */
33
+ export declare const unlessFailed: <Value>(read: () => Promise<Value>) => Promise<Value | null>;
@@ -3,10 +3,10 @@ import {
3
3
  configuredProviders,
4
4
  fromEnv,
5
5
  loadableProviders
6
- } from "../chunks/chunk-UWUPUMM2.js";
7
- import "../chunks/chunk-GFDNRWR3.js";
8
- import "../chunks/chunk-J7DDZ4C2.js";
9
- import "../chunks/chunk-BLCJHP5H.js";
6
+ } from "../chunks/chunk-MW4C6LTN.js";
7
+ import "../chunks/chunk-UFQ4WMLU.js";
8
+ import "../chunks/chunk-QFC4ZHD3.js";
9
+ import "../chunks/chunk-45TXPJW7.js";
10
10
  import "../chunks/chunk-WH6V3YNN.js";
11
11
  export {
12
12
  ALL_PROVIDERS,
@@ -1,4 +1,4 @@
1
- import type { Campaign, CampaignStatus, Channel, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, Reply, ReplyCategory, Sender, SenderStatus, Sequence } from "../internal/entities.ts";
1
+ import type { Campaign, CampaignStatus, Channel, Lead, LeadEngagement, LeadProgress, LeadStatus, MailProvider, Message, MetricRow, RecipientMailProvider, Reply, ReplyCategory, Sender, SenderStatus, Sequence } from "../internal/entities.ts";
2
2
  import type { MetricCounts } from "../internal/metrics.ts";
3
3
  import type { Identity } from "../internal/record.ts";
4
4
  import type { MemoryBlockEntry, MemoryHealth, MemoryList, MemoryPlacementTest, MemorySettings, MemoryTag, MemoryWebhook } from "./account.ts";
@@ -70,6 +70,7 @@ export interface MemoryLead {
70
70
  readonly interest?: string;
71
71
  readonly interestCategory?: ReplyCategory;
72
72
  readonly companyLinkedinUrl?: string;
73
+ readonly recipientMailProvider?: RecipientMailProvider;
73
74
  readonly location?: string;
74
75
  readonly phone?: string;
75
76
  readonly website?: string;
@@ -2,21 +2,21 @@ import {
2
2
  recordBase,
3
3
  refTo,
4
4
  refsTo
5
- } from "../chunks/chunk-2D42TQFU.js";
5
+ } from "../chunks/chunk-LVZGIKNF.js";
6
6
  import {
7
7
  leadProgressSchema
8
- } from "../chunks/chunk-BOWXGMN3.js";
8
+ } from "../chunks/chunk-POBAY3TI.js";
9
9
  import {
10
10
  emptyCounts,
11
11
  sumCounts
12
- } from "../chunks/chunk-PQSTQKRD.js";
12
+ } from "../chunks/chunk-M2VXGLLZ.js";
13
13
  import {
14
14
  SCHEMA_VERSION
15
15
  } from "../chunks/chunk-QGRZDTX4.js";
16
16
  import {
17
17
  assertWorkspaceId,
18
18
  makeRef
19
- } from "../chunks/chunk-QAKJ76HB.js";
19
+ } from "../chunks/chunk-YW6FFVSZ.js";
20
20
  import {
21
21
  profileSlug
22
22
  } from "../chunks/chunk-NAWZ73QS.js";
@@ -26,10 +26,10 @@ import {
26
26
  import {
27
27
  OutboundError,
28
28
  makeErrorMapper
29
- } from "../chunks/chunk-J7DDZ4C2.js";
29
+ } from "../chunks/chunk-QFC4ZHD3.js";
30
30
  import {
31
31
  isNumber
32
- } from "../chunks/chunk-BLCJHP5H.js";
32
+ } from "../chunks/chunk-45TXPJW7.js";
33
33
 
34
34
  // src/memory/account.ts
35
35
  var base = (identity, sourceId) => recordBase(identity, sourceId, null);
@@ -181,7 +181,8 @@ var toEngagement = (seed) => ({
181
181
  var PROGRESS = /* @__PURE__ */ new Set([
182
182
  "active",
183
183
  "completed",
184
- "paused"
184
+ "paused",
185
+ "skipped"
185
186
  ]);
186
187
  var standingOf = (seed) => {
187
188
  const status = seed.status ?? "active";
@@ -212,6 +213,7 @@ var toLead = (identity, seed) => ({
212
213
  linkedinUrl: seed.linkedinUrl ?? null,
213
214
  location: seed.location ?? null,
214
215
  phone: seed.phone ?? null,
216
+ recipientMailProvider: seed.recipientMailProvider ?? null,
215
217
  title: seed.title ?? null,
216
218
  website: seed.website ?? null
217
219
  });
@@ -229,10 +231,17 @@ var messageFields = (identity, seed, channel, includeBody) => ({
229
231
  threadId: seed.threadId ?? null,
230
232
  variantKey: seed.variantKey ?? null
231
233
  });
232
- var toMessage = (identity, seed, channel, includeBody) => ({
233
- ...messageFields(identity, seed, channel, includeBody),
234
- direction: seed.direction
235
- });
234
+ var toMessage = (identity, seed, channel, includeBody) => {
235
+ const message = {
236
+ ...messageFields(identity, seed, channel, includeBody),
237
+ direction: seed.direction
238
+ };
239
+ if (seed.direction === "in" && seed.isAuto !== void 0) {
240
+ message.isAuto = seed.isAuto;
241
+ message.isAutoSource = "vendor";
242
+ }
243
+ return message;
244
+ };
236
245
  var toReply = (identity, seed, channel, includeBody) => ({
237
246
  ...messageFields(identity, seed, channel, includeBody),
238
247
  category: seed.category ?? "unknown",
@@ -295,6 +304,7 @@ var accountReads = (store) => {
295
304
  inProgress: counted("active"),
296
305
  leads: mine.length,
297
306
  notStarted: null,
307
+ skipped: counted("skipped"),
298
308
  stopped: counted("paused")
299
309
  });
300
310
  },
@@ -413,6 +423,7 @@ var FULL_CAPABILITIES = {
413
423
  "campaigns.settings": true,
414
424
  "campaigns.status": "server",
415
425
  "leads.byCampaign": true,
426
+ "leads.byDomain": true,
416
427
  "leads.engagement": true,
417
428
  "leads.get": true,
418
429
  "leads.list": true,
@@ -455,7 +466,7 @@ var selectMessages = (store, query, key) => (store.data.messages ?? []).filter(
455
466
  (message) => (query.campaignId === void 0 || message.campaignId === query.campaignId) && (query.leadId === void 0 || message.leadId === query.leadId) && (query.threadId === void 0 || message.threadId === query.threadId) && (!filtersByTime(store, key) || within(message.sentAt, query))
456
467
  );
457
468
  var selectLeads = (store, query) => (store.data.leads ?? []).filter(
458
- (lead) => (query.campaignId === void 0 || lead.campaignId === query.campaignId) && (query.listId === void 0 || (lead.listIds ?? []).includes(query.listId)) && (query.email === void 0 || lead.email?.trim().toLowerCase() === query.email) && (query.linkedinUrl === void 0 || profileSlug(lead.linkedinUrl) !== null && profileSlug(lead.linkedinUrl) === profileSlug(query.linkedinUrl)) && (!filtersByTime(store, "leads.since") || within(lead.createdAt, query))
469
+ (lead) => (query.campaignId === void 0 || lead.campaignId === query.campaignId) && (query.listId === void 0 || (lead.listIds ?? []).includes(query.listId)) && (query.email === void 0 || lead.email?.trim().toLowerCase() === query.email) && (query.domain === void 0 || lead.email?.trim().toLowerCase().split("@").at(-1) === query.domain) && (query.linkedinUrl === void 0 || profileSlug(lead.linkedinUrl) !== null && profileSlug(lead.linkedinUrl) === profileSlug(query.linkedinUrl)) && (!filtersByTime(store, "leads.since") || within(lead.createdAt, query))
459
470
  );
460
471
  var getters = (store) => {
461
472
  const { data, identity } = store;