outbound-sdk 0.2.1 → 0.4.0

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 (139) hide show
  1. package/dist/alerts/index.js +50 -19
  2. package/dist/alerts/plugin.d.ts +20 -3
  3. package/dist/audit/index.js +2 -2
  4. package/dist/benchmarks/index.js +5 -5
  5. package/dist/budget/index.d.ts +3 -2
  6. package/dist/budget/index.js +11 -10
  7. package/dist/cards/content.d.ts +6 -1
  8. package/dist/cards/format.d.ts +17 -2
  9. package/dist/cards/index.d.ts +1 -1
  10. package/dist/cards/index.js +297 -132
  11. package/dist/cards/parts.d.ts +9 -2
  12. package/dist/cards/render.d.ts +20 -3
  13. package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
  14. package/dist/chunks/chunk-4PA526S7.js +17 -0
  15. package/dist/chunks/{chunk-6CVZOUHB.js → chunk-5CFO3CXG.js} +24 -0
  16. package/dist/chunks/{chunk-XNFESPZH.js → chunk-5FVKRIEJ.js} +168 -31
  17. package/dist/chunks/{chunk-P3IJBJUI.js → chunk-7LNJJ2RO.js} +200 -57
  18. package/dist/chunks/{chunk-XC6CZP73.js → chunk-7ZDS6SZD.js} +7 -1
  19. package/dist/chunks/{chunk-SBIZDCRY.js → chunk-A6WVOCA4.js} +4 -4
  20. package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
  21. package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
  22. package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-C4LS2HNV.js} +3 -3
  23. package/dist/chunks/{chunk-AFU5E5QB.js → chunk-E6DSDCPI.js} +98 -69
  24. package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
  25. package/dist/chunks/{chunk-PURHK3JU.js → chunk-IZFTTMJP.js} +4 -4
  26. package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
  27. package/dist/chunks/{chunk-FKH5N47I.js → chunk-K4USHN4C.js} +1 -1
  28. package/dist/chunks/chunk-LVQUSKEX.js +17 -0
  29. package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
  30. package/dist/chunks/chunk-PTZO4QXR.js +15 -0
  31. package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
  32. package/dist/chunks/chunk-QGRZDTX4.js +26 -0
  33. package/dist/chunks/{chunk-R3Y56YVF.js → chunk-Y5RAJ6PZ.js} +2 -2
  34. package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-ZFVHM5JI.js} +3 -3
  35. package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
  36. package/dist/cli/bin.js +17 -13
  37. package/dist/cli/commands.d.ts +11 -0
  38. package/dist/cli/index.js +17 -13
  39. package/dist/cli/mcp.d.ts +5 -0
  40. package/dist/clients/index.d.ts +1 -1
  41. package/dist/clients/index.js +35 -10
  42. package/dist/clients/plugin.d.ts +9 -2
  43. package/dist/combine/index.js +7 -6
  44. package/dist/exporter/index.d.ts +5 -2
  45. package/dist/exporter/index.js +2 -2
  46. package/dist/failover/index.js +3 -3
  47. package/dist/fixtures/index.js +5 -4
  48. package/dist/heyreach/client.d.ts +2 -0
  49. package/dist/heyreach/index.js +71 -39
  50. package/dist/heyreach/map.d.ts +5 -2
  51. package/dist/identity/index.js +33 -17
  52. package/dist/identity/plugin.d.ts +2 -0
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.js +13 -10
  55. package/dist/insights/campaign.d.ts +3 -0
  56. package/dist/insights/capped.d.ts +29 -0
  57. package/dist/insights/copy/copy-audit.d.ts +2 -0
  58. package/dist/insights/copy/copy-reuse.d.ts +27 -3
  59. package/dist/insights/copy/index.d.ts +8 -8
  60. package/dist/insights/copy/reply-timing.d.ts +8 -0
  61. package/dist/insights/copy/reuse-base.d.ts +32 -0
  62. package/dist/insights/copy/shared.d.ts +39 -15
  63. package/dist/insights/copy/step-funnel.d.ts +16 -5
  64. package/dist/insights/copy/variant-test.d.ts +19 -8
  65. package/dist/insights/define.d.ts +56 -2
  66. package/dist/insights/fields.d.ts +16 -0
  67. package/dist/insights/index.d.ts +2 -1
  68. package/dist/insights/index.js +1494 -730
  69. package/dist/insights/inputs.generated.d.ts +951 -0
  70. package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
  71. package/dist/insights/ops/campaign-ranking.d.ts +12 -4
  72. package/dist/insights/ops/channel-mix.d.ts +2 -1
  73. package/dist/insights/ops/client-report.d.ts +18 -5
  74. package/dist/insights/ops/index.d.ts +6 -2
  75. package/dist/insights/ops/period-comparison.d.ts +14 -3
  76. package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
  77. package/dist/insights/ops/shared.d.ts +29 -24
  78. package/dist/insights/ops/tag-rollup.d.ts +2 -1
  79. package/dist/insights/people/account-summary.d.ts +13 -0
  80. package/dist/insights/people/dropped-replies.d.ts +8 -0
  81. package/dist/insights/people/find.d.ts +7 -1
  82. package/dist/insights/people/hot-leads.d.ts +16 -1
  83. package/dist/insights/people/person-summary.d.ts +6 -0
  84. package/dist/insights/people/read.d.ts +26 -10
  85. package/dist/insights/people/suppression-check.d.ts +11 -2
  86. package/dist/insights/plugin.d.ts +7 -5
  87. package/dist/insights/ref.d.ts +6 -0
  88. package/dist/insights/registry.d.ts +28 -16
  89. package/dist/insights/senders/bounce-watch.d.ts +25 -8
  90. package/dist/insights/senders/capacity-sends.d.ts +22 -0
  91. package/dist/insights/senders/domain-health.d.ts +10 -4
  92. package/dist/insights/senders/index.d.ts +14 -6
  93. package/dist/insights/senders/read.d.ts +15 -14
  94. package/dist/insights/senders/sender-capacity.d.ts +5 -13
  95. package/dist/insights/senders/sender-load.d.ts +2 -0
  96. package/dist/insights/stats.d.ts +8 -0
  97. package/dist/insights/tools.d.ts +3 -2
  98. package/dist/instantly/client.d.ts +2 -0
  99. package/dist/instantly/index.js +44 -29
  100. package/dist/instantly/map.d.ts +6 -2
  101. package/dist/internal/engine/request.d.ts +5 -0
  102. package/dist/internal/entities.d.ts +3 -20
  103. package/dist/internal/errors.d.ts +44 -0
  104. package/dist/internal/fields.d.ts +1 -1
  105. package/dist/internal/json.d.ts +9 -2
  106. package/dist/internal/lists.d.ts +24 -0
  107. package/dist/internal/numbers.d.ts +8 -0
  108. package/dist/internal/outbound/collections.d.ts +4 -0
  109. package/dist/internal/outbound/create.d.ts +24 -3
  110. package/dist/internal/outbound/outbound.d.ts +13 -1
  111. package/dist/internal/outbound/validate.d.ts +4 -0
  112. package/dist/internal/outbound/walker.d.ts +3 -2
  113. package/dist/internal/plural.d.ts +12 -0
  114. package/dist/internal/renamed.d.ts +28 -0
  115. package/dist/internal/vocabulary.d.ts +20 -0
  116. package/dist/loader/index.js +5 -5
  117. package/dist/memory/adapter.d.ts +7 -0
  118. package/dist/memory/demo-stats.d.ts +3 -0
  119. package/dist/memory/demo.d.ts +14 -3
  120. package/dist/memory/index.d.ts +1 -0
  121. package/dist/memory/index.js +200 -95
  122. package/dist/providers/index.d.ts +72 -0
  123. package/dist/providers/index.js +3 -1
  124. package/dist/reconcile/index.js +5 -4
  125. package/dist/redact/index.js +10 -4
  126. package/dist/redact/plugin.d.ts +7 -0
  127. package/dist/smartlead/index.js +102 -49
  128. package/dist/smartlead/shared.d.ts +13 -0
  129. package/dist/sync/index.js +2 -2
  130. package/dist/tools/ai-sdk.js +8 -6
  131. package/dist/tools/campaign-tools.d.ts +1 -1
  132. package/dist/tools/claude-agent.js +8 -6
  133. package/dist/tools/index.js +9 -7
  134. package/dist/tools/input-problem.d.ts +8 -0
  135. package/dist/tools/registry.d.ts +7 -2
  136. package/dist/tools/shared.d.ts +7 -0
  137. package/dist/tracing/index.js +2 -2
  138. package/dist/webhooks/index.js +10 -9
  139. package/package.json +1 -1
@@ -80,29 +80,29 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
80
80
  limit?: number | undefined;
81
81
  max_leads?: number | undefined;
82
82
  }>, import("./define.ts").InsightDefinition<"stepFunnel", {
83
- campaign: string;
84
- from: string | null;
85
83
  min_reply_rate: number;
84
+ from: string | null;
86
85
  to: string | null;
86
+ campaign: string;
87
87
  }, import("./copy/step-funnel.ts").StepFunnel, {
88
88
  campaign: string;
89
- from?: string | null | undefined;
90
89
  min_reply_rate?: number | undefined;
90
+ from?: string | null | undefined;
91
91
  to?: string | null | undefined;
92
92
  }>, import("./define.ts").InsightDefinition<"variantTest", {
93
- alpha: number;
94
- campaign: string;
95
- from: string | null;
96
93
  metric: "positive" | "replied" | "clicked" | "opened";
97
94
  min_sent: number;
95
+ from: string | null;
98
96
  to: string | null;
97
+ alpha: number;
98
+ campaign: string;
99
99
  }, import("./copy/variant-test.ts").VariantTest, {
100
100
  campaign: string;
101
- alpha?: number | undefined;
102
- from?: string | null | undefined;
103
101
  metric?: "positive" | "replied" | "clicked" | "opened" | undefined;
104
102
  min_sent?: number | undefined;
103
+ from?: string | null | undefined;
105
104
  to?: string | null | undefined;
105
+ alpha?: number | undefined;
106
106
  }>, import("./define.ts").InsightDefinition<"copyAudit", {
107
107
  campaign: string;
108
108
  max_body_words: number;
@@ -141,34 +141,42 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
141
141
  timezone_offset_minutes?: number | undefined;
142
142
  }>, import("./define.ts").InsightDefinition<"domainHealth", {
143
143
  max_senders: number;
144
- spam_rate_threshold: number;
144
+ max_spam_rate: number;
145
+ spam_rate_threshold?: number | undefined;
145
146
  }, import("./senders/domain-health.ts").DomainHealth, {
146
147
  max_senders?: number | undefined;
148
+ max_spam_rate?: number | undefined;
147
149
  spam_rate_threshold?: number | undefined;
148
150
  }>, import("./define.ts").InsightDefinition<"senderCapacity", {
149
151
  days: number;
150
152
  max_campaigns: number;
151
153
  max_senders: number;
154
+ split_uncounted: boolean;
152
155
  }, import("./senders/sender-capacity.ts").SenderCapacity, {
153
156
  days?: number | undefined;
154
157
  max_campaigns?: number | undefined;
155
158
  max_senders?: number | undefined;
159
+ split_uncounted?: boolean | undefined;
156
160
  }>, import("./define.ts").InsightDefinition<"bounceWatch", {
157
161
  include_senders: boolean;
162
+ max_bounce_rate: number;
158
163
  max_campaigns: number;
159
164
  max_senders_per_campaign: number;
160
165
  min_sent: number;
161
- threshold: number;
162
- from?: string | undefined;
163
- to?: string | undefined;
166
+ statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
167
+ from: string | null;
168
+ to: string | null;
169
+ threshold?: number | undefined;
164
170
  }, import("./senders/bounce-watch.ts").BounceWatch, {
165
- from?: string | undefined;
166
171
  include_senders?: boolean | undefined;
172
+ max_bounce_rate?: number | undefined;
167
173
  max_campaigns?: number | undefined;
168
174
  max_senders_per_campaign?: number | undefined;
169
175
  min_sent?: number | undefined;
170
176
  threshold?: number | undefined;
171
- to?: string | undefined;
177
+ statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
178
+ from?: string | null | undefined;
179
+ to?: string | null | undefined;
172
180
  }>, import("./define.ts").InsightDefinition<"warmupReadiness", {
173
181
  check_health: boolean;
174
182
  max_senders: number;
@@ -207,6 +215,7 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
207
215
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
208
216
  }>, import("./define.ts").InsightDefinition<"campaignDiagnosis", {
209
217
  campaign: string;
218
+ days: number;
210
219
  daily_limit_share: number;
211
220
  max_bounce_rate: number;
212
221
  max_send_drop: number;
@@ -215,11 +224,12 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
215
224
  min_reply_rate: number;
216
225
  min_sent: number;
217
226
  min_weekly_hours: number;
218
- recent_days: number;
219
227
  from: string | null;
220
228
  to: string | null;
229
+ recent_days?: number | undefined;
221
230
  }, import("./ops/campaign-diagnosis.ts").CampaignDiagnosis, {
222
231
  campaign: string;
232
+ days?: number | undefined;
223
233
  daily_limit_share?: number | undefined;
224
234
  max_bounce_rate?: number | undefined;
225
235
  max_send_drop?: number | undefined;
@@ -308,19 +318,21 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
308
318
  anomaly_threshold: number;
309
319
  baseline_days: number;
310
320
  days: number;
321
+ limit: number;
311
322
  max_bounce_rate: number;
312
323
  max_leads_per_campaign: number;
313
324
  min_baseline_points: number;
314
325
  min_sent: number;
315
326
  runway_days: number;
316
- top: number;
317
327
  max_campaigns: number;
318
328
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
329
+ top?: number | undefined;
319
330
  }, import("./ops/client-report.ts").ClientReport, {
320
331
  alpha?: number | undefined;
321
332
  anomaly_threshold?: number | undefined;
322
333
  baseline_days?: number | undefined;
323
334
  days?: number | undefined;
335
+ limit?: number | undefined;
324
336
  max_bounce_rate?: number | undefined;
325
337
  max_leads_per_campaign?: number | undefined;
326
338
  min_baseline_points?: number | undefined;
@@ -1,10 +1,11 @@
1
+ import type { Measured } from "../ops/shared.ts";
1
2
  import type { Interval } from "../stats.ts";
2
- export interface BounceCounts {
3
+ export interface BounceCounts extends Measured {
3
4
  readonly bounced: number;
4
5
  readonly sent: number;
5
- /** Bounced divided by sent. `null` when nothing was sent. */
6
+ /** Bounced (`count`) divided by sent (`of`). `null` when nothing was sent. */
6
7
  readonly rate: number | null;
7
- /** The Wilson interval of the rate; wide on few sends. */
8
+ /** @deprecated Use `low` and `high`, the Wilson interval of the rate. Removed in 0.5.0. */
8
9
  readonly interval: Interval | null;
9
10
  }
10
11
  export interface BounceSender extends BounceCounts {
@@ -14,6 +15,8 @@ export interface BounceSender extends BounceCounts {
14
15
  }
15
16
  export interface BounceCampaign extends BounceCounts {
16
17
  readonly campaign: string;
18
+ readonly campaignName: string;
19
+ /** @deprecated Use `campaignName`. Removed in 0.5.0. */
17
20
  readonly name: string;
18
21
  readonly status: string;
19
22
  readonly finding: string;
@@ -26,6 +29,8 @@ export interface BounceCampaign extends BounceCounts {
26
29
  }
27
30
  export interface BounceUnknown {
28
31
  readonly campaign: string;
32
+ readonly campaignName: string;
33
+ /** @deprecated Use `campaignName`. Removed in 0.5.0. */
29
34
  readonly name: string;
30
35
  readonly status: string;
31
36
  readonly reason: string;
@@ -48,23 +53,35 @@ export interface BounceWatch {
48
53
  readonly sent: number | null;
49
54
  readonly rate: number | null;
50
55
  };
56
+ /** The `max_bounce_rate` the campaigns were held to. */
57
+ readonly maxBounceRate: number;
58
+ /** @deprecated Use `maxBounceRate`. Removed in 0.5.0. */
51
59
  readonly threshold: number;
52
60
  readonly minSent: number;
61
+ /**
62
+ * Senders whose sent and bounce counts were read. `null` when senders were
63
+ * not checked. A sender with no counts is named in a note, not counted.
64
+ */
65
+ readonly sendersRead: number | null;
53
66
  }
54
67
  export declare const bounceWatch: import("../define.ts").InsightDefinition<"bounceWatch", {
55
68
  include_senders: boolean;
69
+ max_bounce_rate: number;
56
70
  max_campaigns: number;
57
71
  max_senders_per_campaign: number;
58
72
  min_sent: number;
59
- threshold: number;
60
- from?: string | undefined;
61
- to?: string | undefined;
73
+ statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
74
+ from: string | null;
75
+ to: string | null;
76
+ threshold?: number | undefined;
62
77
  }, BounceWatch, {
63
- from?: string | undefined;
64
78
  include_senders?: boolean | undefined;
79
+ max_bounce_rate?: number | undefined;
65
80
  max_campaigns?: number | undefined;
66
81
  max_senders_per_campaign?: number | undefined;
67
82
  min_sent?: number | undefined;
68
83
  threshold?: number | undefined;
69
- to?: string | undefined;
84
+ statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
85
+ from?: string | null | undefined;
86
+ to?: string | null | undefined;
70
87
  }>;
@@ -0,0 +1,22 @@
1
+ import type { Campaign, Sender } from "../../internal/entities.ts";
2
+ import type { Capped } from "../capped.ts";
3
+ import type { InsightContext } from "../define.ts";
4
+ export interface CapacitySends {
5
+ /** Messages sent in the window divided by its days. A day the vendor has no row for counts as no sends. */
6
+ readonly averageDaily: number | null;
7
+ readonly total: number | null;
8
+ readonly days: number;
9
+ /** Days in the window the vendor reported a sent count for. */
10
+ readonly daysWithData: number;
11
+ readonly from: string;
12
+ readonly to: string;
13
+ /** `campaigns` when the sends were added up over the active campaigns read. */
14
+ readonly scope: "campaigns" | "workspace";
15
+ /**
16
+ * Sends in `total` from senders not counted in capacity: inactive, with no
17
+ * daily limit, or past `max_senders`. `utilization` leaves them out. `null`
18
+ * when they could not be told apart, and then `utilization` is `null` too.
19
+ */
20
+ readonly fromUncounted: number | null;
21
+ }
22
+ export declare const readSends: (context: InsightContext, campaigns: readonly Campaign[], days: number, senders: Capped<Sender>, split: boolean) => Promise<CapacitySends | null>;
@@ -1,3 +1,4 @@
1
+ import type { Measured } from "../ops/shared.ts";
1
2
  import type { Interval } from "../stats.ts";
2
3
  import type { DnsRecord } from "./read.ts";
3
4
  export type DomainRisk = "high" | "low" | "medium" | "unknown";
@@ -12,13 +13,14 @@ export interface DomainMailbox {
12
13
  /** Problems in the vendor's own words. */
13
14
  readonly issues: readonly string[];
14
15
  }
15
- export interface DomainWarmup {
16
+ export interface DomainWarmup extends Measured {
16
17
  /** Mailboxes that report warmup spam. The pooled numbers cover only these. */
17
18
  readonly mailboxes: number;
18
19
  readonly sent: number | null;
19
20
  readonly spam: number | null;
21
+ /** @deprecated Use `rate`: warmup emails in spam (`count`) over those sent (`of`). Removed in 0.5.0. */
20
22
  readonly spamRate: number | null;
21
- /** The Wilson interval of the spam rate; wide when few warmup emails were sent. */
23
+ /** @deprecated Use `low` and `high`. Removed in 0.5.0. */
22
24
  readonly interval: Interval | null;
23
25
  }
24
26
  export interface DomainReport {
@@ -30,7 +32,8 @@ export interface DomainReport {
30
32
  /** DNS records that fail on at least one mailbox. */
31
33
  readonly failingDns: readonly DnsRecord[];
32
34
  readonly disconnected: number;
33
- readonly blacklisted: number;
35
+ /** Mailboxes on a block list. `null` when no mailbox of the domain reports its block list status. */
36
+ readonly blacklisted: number | null;
34
37
  readonly warmup: DomainWarmup;
35
38
  /** Checks the vendor reported for no mailbox of the domain. */
36
39
  readonly notReported: readonly string[];
@@ -51,6 +54,7 @@ export interface DomainHealth {
51
54
  /** Mailboxes whose domain is not known, by sender ref. */
52
55
  readonly mailboxesWithoutDomain: readonly string[];
53
56
  readonly totals: {
57
+ /** Senders checked. One the vendor no longer finds is left out, with a note. */
54
58
  readonly senders: number;
55
59
  readonly domains: number;
56
60
  readonly high: number;
@@ -62,8 +66,10 @@ export interface DomainHealth {
62
66
  }
63
67
  export declare const domainHealth: import("../define.ts").InsightDefinition<"domainHealth", {
64
68
  max_senders: number;
65
- spam_rate_threshold: number;
69
+ max_spam_rate: number;
70
+ spam_rate_threshold?: number | undefined;
66
71
  }, DomainHealth, {
67
72
  max_senders?: number | undefined;
73
+ max_spam_rate?: number | undefined;
68
74
  spam_rate_threshold?: number | undefined;
69
75
  }>;
@@ -1,33 +1,41 @@
1
1
  export declare const SENDERS_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"domainHealth", {
2
2
  max_senders: number;
3
- spam_rate_threshold: number;
3
+ max_spam_rate: number;
4
+ spam_rate_threshold?: number | undefined;
4
5
  }, import("./domain-health.ts").DomainHealth, {
5
6
  max_senders?: number | undefined;
7
+ max_spam_rate?: number | undefined;
6
8
  spam_rate_threshold?: number | undefined;
7
9
  }>, import("../define.ts").InsightDefinition<"senderCapacity", {
8
10
  days: number;
9
11
  max_campaigns: number;
10
12
  max_senders: number;
13
+ split_uncounted: boolean;
11
14
  }, import("./sender-capacity.ts").SenderCapacity, {
12
15
  days?: number | undefined;
13
16
  max_campaigns?: number | undefined;
14
17
  max_senders?: number | undefined;
18
+ split_uncounted?: boolean | undefined;
15
19
  }>, import("../define.ts").InsightDefinition<"bounceWatch", {
16
20
  include_senders: boolean;
21
+ max_bounce_rate: number;
17
22
  max_campaigns: number;
18
23
  max_senders_per_campaign: number;
19
24
  min_sent: number;
20
- threshold: number;
21
- from?: string | undefined;
22
- to?: string | undefined;
25
+ statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
26
+ from: string | null;
27
+ to: string | null;
28
+ threshold?: number | undefined;
23
29
  }, import("./bounce-watch.ts").BounceWatch, {
24
- from?: string | undefined;
25
30
  include_senders?: boolean | undefined;
31
+ max_bounce_rate?: number | undefined;
26
32
  max_campaigns?: number | undefined;
27
33
  max_senders_per_campaign?: number | undefined;
28
34
  min_sent?: number | undefined;
29
35
  threshold?: number | undefined;
30
- to?: string | undefined;
36
+ statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
37
+ from?: string | null | undefined;
38
+ to?: string | null | undefined;
31
39
  }>, import("../define.ts").InsightDefinition<"warmupReadiness", {
32
40
  check_health: boolean;
33
41
  max_senders: number;
@@ -1,23 +1,22 @@
1
- import { z } from "zod";
2
1
  import type { SenderHealth } from "../../internal/entities-account.ts";
3
2
  import type { Campaign, CampaignStatus, Sender } from "../../internal/entities.ts";
4
3
  import type { ListAll } from "../../internal/outbound/api.ts";
4
+ import type { Capped } from "../capped.ts";
5
5
  import type { InsightContext } from "../define.ts";
6
- export declare const statusesInput: z.ZodDefault<z.ZodArray<z.ZodEnum<{
7
- active: "active";
8
- archived: "archived";
9
- completed: "completed";
10
- draft: "draft";
11
- paused: "paused";
12
- unknown: "unknown";
13
- }>>>;
14
- export declare const dayInput: (what: string) => z.ZodOptional<z.ZodString>;
15
- /** Walks a listing up to `max` records, and says so in a note when more exist. */
16
- export declare const readCapped: <Item>(context: InsightContext, walk: (max: number) => ListAll<Item>, max: number, what: string) => Promise<Item[]>;
17
- /** The campaigns in the given statuses, up to `max`. */
6
+ /** Walks a listing up to `max` records, and says so in a note naming `input` when more exist. */
7
+ export declare const readCapped: <Item>(context: InsightContext, walk: (max: number) => ListAll<Item>, max: number, what: string, input: string) => Promise<Item[]>;
8
+ /** The campaigns in the given statuses, up to `max_campaigns`. */
18
9
  export declare const readCampaigns: (context: InsightContext, statuses: readonly CampaignStatus[], max: number) => Promise<Campaign[]>;
19
10
  /** The senders attached to one campaign, up to `max`. */
20
- export declare const readCampaignSenders: (context: InsightContext, campaign: Campaign, max: number) => Promise<Sender[]>;
11
+ export declare const readCampaignSenders: (context: InsightContext, campaign: Campaign, max: number, input: string) => Promise<Sender[]>;
12
+ /** Every sender of the workspace, up to `max_senders`, and whether more exist. */
13
+ export declare const readSenders: (context: InsightContext, max: number) => Promise<Capped<Sender>>;
14
+ /**
15
+ * One sender's health, or `null` when the vendor no longer finds the sender,
16
+ * for example a mailbox deleted mid-run. That sender is left out with a note
17
+ * naming it, and the answer is marked incomplete. Any other error throws.
18
+ */
19
+ export declare const readHealth: (context: InsightContext, sender: Sender) => Promise<SenderHealth | null>;
21
20
  /** The part after the `@`, lowercased. `null` for a LinkedIn seat. */
22
21
  export declare const domainOf: (address: string | null) => string | null;
23
22
  export declare const DNS_RECORDS: readonly ["spf", "dkim", "dmarc", "mx"];
@@ -35,3 +34,5 @@ export interface WarmupSpam {
35
34
  export declare const warmupSpam: (health: SenderHealth) => WarmupSpam | null;
36
35
  /** Today in UTC, plus or minus whole days, as `YYYY-MM-DD`. */
37
36
  export declare const dayFrom: (now: number, offsetDays: number) => string;
37
+ /** A count for every key, in the keys' alphabetical order. */
38
+ export declare const countEach: <Key extends string>(keys: readonly Key[], count: (key: Key) => number) => Readonly<Record<Key, number>>;
@@ -1,3 +1,5 @@
1
+ import type { CapacitySends } from "./capacity-sends.ts";
2
+ export type { CapacitySends } from "./capacity-sends.ts";
1
3
  export interface CapacityTotals {
2
4
  /** The sum of the daily limits of active senders. `null` when no active sender reports one. */
3
5
  readonly daily: number | null;
@@ -17,18 +19,6 @@ export interface CapacityAsk {
17
19
  readonly withLimit: number;
18
20
  readonly withoutLimit: number;
19
21
  }
20
- export interface CapacitySends {
21
- /** Messages sent in the window divided by its days. A day the vendor has no row for counts as no sends. */
22
- readonly averageDaily: number | null;
23
- readonly total: number | null;
24
- readonly days: number;
25
- /** Days in the window the vendor reported a sent count for. */
26
- readonly daysWithData: number;
27
- readonly from: string;
28
- readonly to: string;
29
- /** `campaigns` when the sends were added up over the active campaigns read. */
30
- readonly scope: "campaigns" | "workspace";
31
- }
32
22
  export interface ShortCampaign {
33
23
  readonly campaign: string;
34
24
  readonly name: string;
@@ -47,7 +37,7 @@ export interface SenderCapacity {
47
37
  readonly ask: CapacityAsk | null;
48
38
  /** `null` when the adapter has no daily stats. */
49
39
  readonly sends: CapacitySends | null;
50
- /** Average daily sends divided by daily capacity. */
40
+ /** Average daily sends of the senders counted in capacity, divided by daily capacity. */
51
41
  readonly utilization: number | null;
52
42
  /** The daily ask divided by daily capacity. Over 1 means the campaigns ask for more than the senders can send. */
53
43
  readonly askRatio: number | null;
@@ -60,8 +50,10 @@ export declare const senderCapacity: import("../define.ts").InsightDefinition<"s
60
50
  days: number;
61
51
  max_campaigns: number;
62
52
  max_senders: number;
53
+ split_uncounted: boolean;
63
54
  }, SenderCapacity, {
64
55
  days?: number | undefined;
65
56
  max_campaigns?: number | undefined;
66
57
  max_senders?: number | undefined;
58
+ split_uncounted?: boolean | undefined;
67
59
  }>;
@@ -15,6 +15,8 @@ export interface OverusedSender extends LoadedSender {
15
15
  export type CampaignSenderIssue = "inactive_sender" | "no_sender" | "single_sender";
16
16
  export interface CampaignSenderRisk {
17
17
  readonly campaign: string;
18
+ readonly campaignName: string;
19
+ /** @deprecated Use `campaignName`. Removed in 0.5.0. */
18
20
  readonly name: string;
19
21
  readonly senders: number;
20
22
  readonly issues: readonly CampaignSenderIssue[];
@@ -39,6 +39,14 @@ export interface Sample {
39
39
  * 0 or 1.
40
40
  */
41
41
  export declare const compareRates: (first: Sample, second: Sample, alpha?: number) => ProportionTest | null;
42
+ /** A rate for a sentence: `0.0525` as `5.3%`. `unknown` for `null`. */
43
+ export declare const percent: (value: number | null) => string;
44
+ /**
45
+ * A count, average, length or score for a sentence, with at most one
46
+ * decimal: `1.3333` as `1.3`, and `unknown` for `null`. The answer's own
47
+ * fields keep full precision.
48
+ */
49
+ export declare const spoken: (value: number | null) => string;
42
50
  /** A p-value for a sentence. One that rounds to 0 is written `p < 0.0001`, never `p = 0`. */
43
51
  export declare const pText: (pValue: number) => string;
44
52
  /** Counts how often each value occurs, in first-seen order. */
@@ -6,8 +6,9 @@ export interface InsightToolsOptions {
6
6
  }
7
7
  /**
8
8
  * The insights this instance can serve, as tools. An insight whose adapter
9
- * lacks a capability it needs is left out, so a model is never offered a tool
10
- * that cannot work.
9
+ * lacks a capability or a field it needs, or that cannot match records while the redact
10
+ * plugin masks what it matches on, is left out, so a model is never offered a
11
+ * tool that cannot work. A `next` hint naming a left-out insight is dropped.
11
12
  *
12
13
  * ```ts
13
14
  * openaiTools(outbound, { extra: insightTools(outbound) });
@@ -18,6 +18,8 @@ export interface InstantlyClient extends VendorClient {
18
18
  readonly readTags: boolean;
19
19
  /** `get`, for an endpoint that returns one object. */
20
20
  readonly getObject: (ctx: AdapterContext, path: string, options?: GetOptions) => Promise<JsonObject>;
21
+ /** `get`, for an analytics report: a bare array, or a `Provider` error. */
22
+ readonly getRows: (ctx: AdapterContext, path: string, options?: GetOptions) => Promise<JsonObject[]>;
21
23
  }
22
24
  export declare const isSecret: (path: string, query: URLSearchParams) => boolean;
23
25
  export declare const isRead: (method: HttpMethod, path: string) => boolean;
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  EVENT_TYPES,
3
3
  instantlyEvents
4
- } from "../chunks/chunk-SBIZDCRY.js";
4
+ } from "../chunks/chunk-A6WVOCA4.js";
5
5
  import {
6
6
  createVendorClient,
7
7
  flatMapPage,
8
+ listIn,
8
9
  mapPage,
9
10
  normalizeBody,
10
11
  withLeadFields,
11
12
  withMappedFields
12
- } from "../chunks/chunk-6CVZOUHB.js";
13
+ } from "../chunks/chunk-5CFO3CXG.js";
13
14
  import {
14
15
  leadStanding,
15
16
  toVariant,
16
17
  variantKey
17
- } from "../chunks/chunk-FKH5N47I.js";
18
+ } from "../chunks/chunk-K4USHN4C.js";
18
19
  import {
19
20
  defineNative,
20
21
  inBody,
@@ -27,28 +28,29 @@ import {
27
28
  emptyCounts,
28
29
  metricRow,
29
30
  sumCounts
30
- } from "../chunks/chunk-YOTW5ESM.js";
31
+ } from "../chunks/chunk-PQSTQKRD.js";
31
32
  import "../chunks/chunk-NAWZ73QS.js";
32
33
  import "../chunks/chunk-FHKSLCVW.js";
33
34
  import {
34
35
  readEnv,
35
36
  requireCredential
36
- } from "../chunks/chunk-IPUYZD4O.js";
37
+ } from "../chunks/chunk-GFDNRWR3.js";
37
38
  import {
38
39
  eventTypesOf,
39
40
  recordBase,
40
41
  refTo,
41
42
  refsTo
42
- } from "../chunks/chunk-U2D34ARZ.js";
43
- import "../chunks/chunk-4PSO6JEK.js";
43
+ } from "../chunks/chunk-2D42TQFU.js";
44
+ import "../chunks/chunk-BOWXGMN3.js";
45
+ import "../chunks/chunk-QGRZDTX4.js";
44
46
  import {
45
47
  assertWorkspaceId
46
- } from "../chunks/chunk-LVYG7XZJ.js";
48
+ } from "../chunks/chunk-QAKJ76HB.js";
47
49
  import {
48
50
  OutboundError,
49
51
  makeErrorMapper,
50
52
  requireObject
51
- } from "../chunks/chunk-E7JHLNLG.js";
53
+ } from "../chunks/chunk-J7DDZ4C2.js";
52
54
  import {
53
55
  count,
54
56
  emailAddress,
@@ -63,7 +65,7 @@ import {
63
65
  text,
64
66
  timestamp,
65
67
  withoutKeys
66
- } from "../chunks/chunk-VQSCHOBV.js";
68
+ } from "../chunks/chunk-BLCJHP5H.js";
67
69
 
68
70
  // src/instantly/map-account.ts
69
71
  var CLOCK = /^\d{2}:\d{2}$/u;
@@ -385,8 +387,10 @@ var toWorkspace = (identity, raw) => ({
385
387
  ...recordBase(identity, text(raw.id) ?? identity.workspaceId, raw),
386
388
  name: text(raw.name) ?? identity.workspaceId
387
389
  });
388
- var listEnvelope = (body) => ({
389
- items: objects(isJsonObject(body) ? body.items : body),
390
+ var listEnvelope = (body, provider, path) => ({
391
+ items: objects(
392
+ listIn(body, { key: "items", path, provider, vendor: "Instantly" })
393
+ ),
390
394
  next: text(field(body, "next_starting_after")) ?? void 0
391
395
  });
392
396
 
@@ -717,7 +721,9 @@ var listPage = async (client, ctx, path, query, filters = {}) => listEnvelope(
717
721
  limit: pageSize(query.limit),
718
722
  starting_after: after(query.next)
719
723
  }
720
- })
724
+ }),
725
+ client.identity.provider,
726
+ path
721
727
  );
722
728
  var readLookup = async (client, ctx, lookup, next) => {
723
729
  const envelope = await listPage(
@@ -759,9 +765,9 @@ var accountReaders = (client) => {
759
765
  return {
760
766
  // The per-campaign report, asked for one campaign: an array of one row.
761
767
  getCampaignProgress: async (id, ctx) => {
762
- const rows = objects(
763
- await client.get(ctx, "/campaigns/analytics", { query: { id } })
764
- );
768
+ const rows = await client.getRows(ctx, "/campaigns/analytics", {
769
+ query: { id }
770
+ });
765
771
  const row = rows.find((each) => text(each.campaign_id) === id) ?? rows[0];
766
772
  if (row === void 0) {
767
773
  throw new OutboundError("NotFound", `Campaign ${id} was not found`, {
@@ -880,7 +886,9 @@ var listEmails = async (client, ctx, query, received) => {
880
886
  search: threadId === void 0 ? void 0 : `thread:${threadId}`,
881
887
  starting_after: cursor.after
882
888
  }
883
- })
889
+ }),
890
+ client.identity.provider,
891
+ "/emails"
884
892
  );
885
893
  const sent = envelope.items.filter((item) => !isScheduled(item));
886
894
  return {
@@ -973,11 +981,9 @@ var range = (query) => ({
973
981
  start_date: query.from
974
982
  });
975
983
  var senderStats = async (client, ctx, scope, query) => {
976
- const days2 = objects(
977
- await client.get(ctx, "/accounts/analytics/daily", {
978
- query: { ...range(query), emails: scope.scopeId }
979
- })
980
- );
984
+ const days2 = await client.getRows(ctx, "/accounts/analytics/daily", {
985
+ query: { ...range(query), emails: scope.scopeId }
986
+ });
981
987
  return query.by === "day" ? days2.map((day) => dailyRow(scope, day)) : [summedRow(scope, days2)];
982
988
  };
983
989
  var readStats = async (client, ctx, query) => {
@@ -998,10 +1004,10 @@ var readStats = async (client, ctx, query) => {
998
1004
  { provider: identity.provider }
999
1005
  );
1000
1006
  }
1001
- const campaigns = await client.get(ctx, "/campaigns/analytics", {
1007
+ const campaigns = await client.getRows(ctx, "/campaigns/analytics", {
1002
1008
  query: range(query)
1003
1009
  });
1004
- return objects(campaigns).flatMap((campaign) => {
1010
+ return campaigns.flatMap((campaign) => {
1005
1011
  const scopeId = text(campaign.campaign_id);
1006
1012
  return scopeId === null ? [] : [campaignRow({ ...scope, scopeId }, campaign)];
1007
1013
  });
@@ -1016,16 +1022,16 @@ var readStats = async (client, ctx, query) => {
1016
1022
  }
1017
1023
  );
1018
1024
  }
1019
- const steps = await client.get(ctx, "/campaigns/analytics/steps", {
1025
+ const steps = await client.getRows(ctx, "/campaigns/analytics/steps", {
1020
1026
  query: { ...range(query), campaign_id: query.scopeId }
1021
1027
  });
1022
- return objects(steps).map((step) => stepRow(scope, step));
1028
+ return steps.map((step) => stepRow(scope, step));
1023
1029
  }
1024
1030
  if (query.by === "day") {
1025
- const days2 = await client.get(ctx, "/campaigns/analytics/daily", {
1031
+ const days2 = await client.getRows(ctx, "/campaigns/analytics/daily", {
1026
1032
  query: { ...range(query), campaign_id: query.scopeId }
1027
1033
  });
1028
- return objects(days2).map((day) => dailyRow(scope, day));
1034
+ return days2.map((day) => dailyRow(scope, day));
1029
1035
  }
1030
1036
  const overview = await client.getObject(
1031
1037
  ctx,
@@ -1178,7 +1184,9 @@ var leadReaders = (client) => ({
1178
1184
  return { items: [] };
1179
1185
  }
1180
1186
  const envelope = listEnvelope(
1181
- await client.post(ctx, "/leads/list", leadListBody(query))
1187
+ await client.post(ctx, "/leads/list", leadListBody(query)),
1188
+ client.identity.provider,
1189
+ "/leads/list"
1182
1190
  );
1183
1191
  const labels = await readLabels(
1184
1192
  client,
@@ -2575,6 +2583,13 @@ var createClient = (options) => {
2575
2583
  options.identity.provider,
2576
2584
  `Instantly returned no object for ${path}`
2577
2585
  ),
2586
+ getRows: async (ctx, path, request) => objects(
2587
+ listIn(await http.get(ctx, path, request), {
2588
+ path,
2589
+ provider: options.identity.provider,
2590
+ vendor: "Instantly"
2591
+ })
2592
+ ),
2578
2593
  identity: options.identity,
2579
2594
  raw: { authorize, baseUrl, isRead, isSecret },
2580
2595
  readTags: options.readTags