outbound-sdk 0.4.0 → 0.6.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 (104) hide show
  1. package/README.md +2 -2
  2. package/dist/alerts/check-evaluate.d.ts +53 -0
  3. package/dist/alerts/check-measure.d.ts +100 -0
  4. package/dist/alerts/check-schema.d.ts +184 -0
  5. package/dist/alerts/check-validate.d.ts +18 -0
  6. package/dist/alerts/index.d.ts +7 -0
  7. package/dist/alerts/index.js +635 -2
  8. package/dist/budget/index.d.ts +2 -0
  9. package/dist/budget/index.js +1 -0
  10. package/dist/cards/format.d.ts +1 -1
  11. package/dist/cards/index.js +49 -19
  12. package/dist/cards/parts.d.ts +1 -6
  13. package/dist/chunks/{chunk-7LNJJ2RO.js → chunk-3JOC5DGD.js} +127 -17
  14. package/dist/chunks/chunk-53DCVFUB.js +55 -0
  15. package/dist/chunks/{chunk-E6DSDCPI.js → chunk-BK5SLY32.js} +92 -101
  16. package/dist/chunks/chunk-HPNGSG5E.js +51 -0
  17. package/dist/chunks/chunk-HWHI4LFY.js +102 -0
  18. package/dist/chunks/chunk-MGR6HREO.js +91 -0
  19. package/dist/chunks/{chunk-Y5RAJ6PZ.js → chunk-OLPMBRXM.js} +3 -2
  20. package/dist/chunks/{chunk-IZFTTMJP.js → chunk-PHNQ3WC2.js} +5 -5
  21. package/dist/chunks/chunk-SXGCKCAR.js +678 -0
  22. package/dist/chunks/chunk-TFICTGM2.js +18 -0
  23. package/dist/chunks/{chunk-ZFVHM5JI.js → chunk-UWUPUMM2.js} +11 -4
  24. package/dist/chunks/{chunk-A6WVOCA4.js → chunk-W22SDX6S.js} +4 -4
  25. package/dist/chunks/{chunk-7ZDS6SZD.js → chunk-WH6V3YNN.js} +25 -0
  26. package/dist/chunks/chunk-XL6LJVHJ.js +71 -0
  27. package/dist/chunks/{chunk-5FVKRIEJ.js → chunk-YYCT3NGV.js} +35 -11
  28. package/dist/cli/bin.js +13 -28
  29. package/dist/cli/index.d.ts +3 -0
  30. package/dist/cli/index.js +12 -11
  31. package/dist/cli/output.d.ts +9 -0
  32. package/dist/cli/update.d.ts +15 -0
  33. package/dist/emailbison/account.d.ts +7 -0
  34. package/dist/emailbison/adapter.d.ts +5 -0
  35. package/dist/emailbison/capabilities.d.ts +78 -0
  36. package/dist/emailbison/client.d.ts +29 -0
  37. package/dist/emailbison/index.d.ts +30 -0
  38. package/dist/emailbison/index.js +1018 -0
  39. package/dist/emailbison/mail.d.ts +5 -0
  40. package/dist/emailbison/map-mail.d.ts +13 -0
  41. package/dist/emailbison/map-sequence.d.ts +12 -0
  42. package/dist/emailbison/map-stats.d.ts +47 -0
  43. package/dist/emailbison/map.d.ts +24 -0
  44. package/dist/emailbison/native-params.d.ts +5 -0
  45. package/dist/emailbison/native-workspace.d.ts +167 -0
  46. package/dist/emailbison/native.d.ts +327 -0
  47. package/dist/emailbison/stats.d.ts +4 -0
  48. package/dist/emailbison/webhooks.d.ts +2 -0
  49. package/dist/fixtures/index.js +6 -6
  50. package/dist/heyreach/capabilities.d.ts +3 -0
  51. package/dist/heyreach/index.js +22 -20
  52. package/dist/index.js +19 -18
  53. package/dist/insights/copy/copy-preview.d.ts +58 -0
  54. package/dist/insights/copy/copy-reuse.d.ts +0 -13
  55. package/dist/insights/copy/index.d.ts +9 -0
  56. package/dist/insights/copy/reuse-base.d.ts +0 -2
  57. package/dist/insights/copy/shared.d.ts +3 -8
  58. package/dist/insights/copy/step-funnel.d.ts +1 -12
  59. package/dist/insights/copy/variant-test.d.ts +0 -5
  60. package/dist/insights/cost.d.ts +91 -0
  61. package/dist/insights/define.d.ts +22 -1
  62. package/dist/insights/index.d.ts +4 -3
  63. package/dist/insights/index.js +810 -415
  64. package/dist/insights/inputs.generated.d.ts +21 -24
  65. package/dist/insights/ops/campaign-diagnosis.d.ts +0 -2
  66. package/dist/insights/ops/campaign-ranking.d.ts +3 -3
  67. package/dist/insights/ops/client-report.d.ts +0 -2
  68. package/dist/insights/ops/index.d.ts +2 -6
  69. package/dist/insights/ops/shared.d.ts +10 -2
  70. package/dist/insights/plugin.d.ts +19 -0
  71. package/dist/insights/registry.d.ts +10 -10
  72. package/dist/insights/run-cap.d.ts +35 -0
  73. package/dist/insights/senders/bounce-watch.d.ts +0 -11
  74. package/dist/insights/senders/domain-health.d.ts +0 -7
  75. package/dist/insights/senders/index.d.ts +0 -4
  76. package/dist/insights/senders/sender-load.d.ts +0 -2
  77. package/dist/insights/tools.d.ts +10 -0
  78. package/dist/insights/types.d.ts +1 -1
  79. package/dist/insights/variables.d.ts +33 -0
  80. package/dist/instantly/capabilities.d.ts +13 -0
  81. package/dist/instantly/index.js +43 -28
  82. package/dist/internal/adapter.d.ts +12 -0
  83. package/dist/internal/outbound/outbound.d.ts +5 -1
  84. package/dist/internal/request-cap.d.ts +35 -0
  85. package/dist/loader/index.js +2 -2
  86. package/dist/memory/index.js +10 -10
  87. package/dist/providers/index.d.ts +21 -1
  88. package/dist/providers/index.js +1 -1
  89. package/dist/redact/index.js +4 -4
  90. package/dist/smartlead/capabilities.d.ts +5 -0
  91. package/dist/smartlead/index.js +26 -24
  92. package/dist/tools/ai-sdk.js +5 -3
  93. package/dist/tools/claude-agent.js +5 -3
  94. package/dist/tools/index.d.ts +2 -2
  95. package/dist/tools/index.js +11 -6
  96. package/dist/tools/registry.d.ts +20 -1
  97. package/dist/tools/shared.d.ts +20 -1
  98. package/dist/webhooks/index.js +17 -7
  99. package/package.json +8 -2
  100. package/dist/chunks/chunk-5CFO3CXG.js +0 -176
  101. package/dist/chunks/chunk-K4USHN4C.js +0 -40
  102. package/dist/chunks/chunk-LVQUSKEX.js +0 -17
  103. package/dist/internal/renamed.d.ts +0 -28
  104. package/dist/chunks/{chunk-C4LS2HNV.js → chunk-JWGSB7PT.js} +3 -3
@@ -336,6 +336,27 @@ export interface InsightInputs {
336
336
  */
337
337
  readonly spam_words?: string[] | undefined;
338
338
  };
339
+ /** The input of `copyPreview` (the `copy_preview` tool). */
340
+ readonly copyPreview: {
341
+ /**
342
+ * The campaign's ref, for example `instantly:acme:abc123`
343
+ *
344
+ * Not empty. Required.
345
+ */
346
+ readonly campaign: string;
347
+ /**
348
+ * The lead's ref to render the copy for. null picks the lead read with the most variables filled.
349
+ *
350
+ * Not empty. Defaults to `null`.
351
+ */
352
+ readonly lead?: string | null | undefined;
353
+ /**
354
+ * The most leads to read when picking one. Ignored when `lead` is given.
355
+ *
356
+ * A whole number from 1 to 1000. Defaults to `100`.
357
+ */
358
+ readonly max_leads?: number | undefined;
359
+ };
339
360
  /** The input of `copyReuse` (the `copy_reuse` tool). */
340
361
  readonly copyReuse: {
341
362
  /**
@@ -398,12 +419,6 @@ export interface InsightInputs {
398
419
  * A number from 0 to 1. Defaults to `0.1`.
399
420
  */
400
421
  readonly max_spam_rate?: number | undefined;
401
- /**
402
- * @deprecated Renamed to `max_spam_rate`. Removed in 0.5.0.
403
- *
404
- * A number from 0 to 1.
405
- */
406
- readonly spam_rate_threshold?: number | undefined;
407
422
  };
408
423
  /** The input of `senderCapacity` (the `sender_capacity` tool). */
409
424
  readonly senderCapacity: {
@@ -476,12 +491,6 @@ export interface InsightInputs {
476
491
  * A whole number from 0 to 9,007,199,254,740,991. Defaults to `100`.
477
492
  */
478
493
  readonly min_sent?: number | undefined;
479
- /**
480
- * @deprecated Renamed to `max_bounce_rate`. Removed in 0.5.0.
481
- *
482
- * A number from 0 to 1.
483
- */
484
- readonly threshold?: number | undefined;
485
494
  /**
486
495
  * Only campaigns in one of these states are read: active, paused, completed, draft, archived or unknown
487
496
  *
@@ -662,12 +671,6 @@ export interface InsightInputs {
662
671
  * A number from 0 to 168. Defaults to `20`.
663
672
  */
664
673
  readonly min_weekly_hours?: number | undefined;
665
- /**
666
- * @deprecated Renamed to `days`. Removed in 0.5.0.
667
- *
668
- * A whole number from 1 to 30.
669
- */
670
- readonly recent_days?: number | undefined;
671
674
  };
672
675
  /** The input of `pipelineForecast` (the `pipeline_forecast` tool). */
673
676
  readonly pipelineForecast: {
@@ -941,11 +944,5 @@ export interface InsightInputs {
941
944
  * A number, 0 or more. Defaults to `7`.
942
945
  */
943
946
  readonly runway_days?: number | undefined;
944
- /**
945
- * @deprecated Renamed to `limit`. Removed in 0.5.0.
946
- *
947
- * A whole number from 1 to 20.
948
- */
949
- readonly top?: number | undefined;
950
947
  };
951
948
  }
@@ -23,7 +23,6 @@ export declare const campaignDiagnosis: import("../define.ts").InsightDefinition
23
23
  min_weekly_hours: number;
24
24
  from: string | null;
25
25
  to: string | null;
26
- recent_days?: number | undefined;
27
26
  }, CampaignDiagnosis, {
28
27
  campaign: string;
29
28
  days?: number | undefined;
@@ -35,7 +34,6 @@ export declare const campaignDiagnosis: import("../define.ts").InsightDefinition
35
34
  min_reply_rate?: number | undefined;
36
35
  min_sent?: number | undefined;
37
36
  min_weekly_hours?: number | undefined;
38
- recent_days?: number | undefined;
39
37
  from?: string | null | undefined;
40
38
  to?: string | null | undefined;
41
39
  }>;
@@ -2,8 +2,8 @@ import { z } from "zod";
2
2
  import type { CampaignsRead } from "../capped.ts";
3
3
  import type { CampaignLabel, CampaignTotals, Measured, OpenRange, ReplyBasis } from "./shared.ts";
4
4
  declare const metricSchema: z.ZodEnum<{
5
- reply_rate: "reply_rate";
6
5
  bounce_rate: "bounce_rate";
6
+ reply_rate: "reply_rate";
7
7
  positive_reply_rate: "positive_reply_rate";
8
8
  }>;
9
9
  export type RankingMetric = z.infer<typeof metricSchema>;
@@ -47,14 +47,14 @@ export interface CampaignRanking extends Ranking, CampaignsRead {
47
47
  */
48
48
  export declare const rankCampaigns: (entries: readonly CampaignTotals[], metric: RankingMetric, minSent: number, replyBasis?: ReplyBasis) => Ranking;
49
49
  export declare const campaignRanking: import("../define.ts").InsightDefinition<"campaignRanking", {
50
- metric: "reply_rate" | "bounce_rate" | "positive_reply_rate";
50
+ metric: "bounce_rate" | "reply_rate" | "positive_reply_rate";
51
51
  min_sent: number;
52
52
  max_campaigns: number;
53
53
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
54
54
  from: string | null;
55
55
  to: string | null;
56
56
  }, CampaignRanking, {
57
- metric?: "reply_rate" | "bounce_rate" | "positive_reply_rate" | undefined;
57
+ metric?: "bounce_rate" | "reply_rate" | "positive_reply_rate" | undefined;
58
58
  min_sent?: number | undefined;
59
59
  max_campaigns?: number | undefined;
60
60
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
@@ -71,7 +71,6 @@ export declare const clientReport: import("../define.ts").InsightDefinition<"cli
71
71
  runway_days: number;
72
72
  max_campaigns: number;
73
73
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
74
- top?: number | undefined;
75
74
  }, ClientReport, {
76
75
  alpha?: number | undefined;
77
76
  anomaly_threshold?: number | undefined;
@@ -83,7 +82,6 @@ export declare const clientReport: import("../define.ts").InsightDefinition<"cli
83
82
  min_baseline_points?: number | undefined;
84
83
  min_sent?: number | undefined;
85
84
  runway_days?: number | undefined;
86
- top?: number | undefined;
87
85
  max_campaigns?: number | undefined;
88
86
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
89
87
  }>;
@@ -11,7 +11,6 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
11
11
  min_weekly_hours: number;
12
12
  from: string | null;
13
13
  to: string | null;
14
- recent_days?: number | undefined;
15
14
  }, import("./campaign-diagnosis.ts").CampaignDiagnosis, {
16
15
  campaign: string;
17
16
  days?: number | undefined;
@@ -23,7 +22,6 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
23
22
  min_reply_rate?: number | undefined;
24
23
  min_sent?: number | undefined;
25
24
  min_weekly_hours?: number | undefined;
26
- recent_days?: number | undefined;
27
25
  from?: string | null | undefined;
28
26
  to?: string | null | undefined;
29
27
  }>, import("../define.ts").InsightDefinition<"pipelineForecast", {
@@ -61,14 +59,14 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
61
59
  max_campaigns?: number | undefined;
62
60
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
63
61
  }>, import("../define.ts").InsightDefinition<"campaignRanking", {
64
- metric: "reply_rate" | "bounce_rate" | "positive_reply_rate";
62
+ metric: "bounce_rate" | "reply_rate" | "positive_reply_rate";
65
63
  min_sent: number;
66
64
  max_campaigns: number;
67
65
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
68
66
  from: string | null;
69
67
  to: string | null;
70
68
  }, import("./campaign-ranking.ts").CampaignRanking, {
71
- metric?: "reply_rate" | "bounce_rate" | "positive_reply_rate" | undefined;
69
+ metric?: "bounce_rate" | "reply_rate" | "positive_reply_rate" | undefined;
72
70
  min_sent?: number | undefined;
73
71
  max_campaigns?: number | undefined;
74
72
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
@@ -111,7 +109,6 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
111
109
  runway_days: number;
112
110
  max_campaigns: number;
113
111
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
114
- top?: number | undefined;
115
112
  }, import("./client-report.ts").ClientReport, {
116
113
  alpha?: number | undefined;
117
114
  anomaly_threshold?: number | undefined;
@@ -123,7 +120,6 @@ export declare const OPS_INSIGHTS: readonly [import("../define.ts").InsightDefin
123
120
  min_baseline_points?: number | undefined;
124
121
  min_sent?: number | undefined;
125
122
  runway_days?: number | undefined;
126
- top?: number | undefined;
127
123
  max_campaigns?: number | undefined;
128
124
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
129
125
  }>];
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import type { Campaign, CampaignStatus } from "../../internal/entities.ts";
3
3
  import type { MetricCounts } from "../../internal/metrics.ts";
4
4
  import type { CampaignsRead } from "../capped.ts";
5
+ import type { Price } from "../cost.ts";
5
6
  import type { InsightContext } from "../define.ts";
6
7
  /** The UTC day of a time, as `YYYY-MM-DD`. */
7
8
  export declare const dayOf: (time: number) => string;
@@ -25,6 +26,15 @@ export interface OpenRange {
25
26
  readonly to: string | null;
26
27
  }
27
28
  /** Input fields the campaign-listing insights share. */
29
+ /**
30
+ * What `readCampaignTotals` costs: the listing, then one stats read per
31
+ * campaign, or one for all of them where the vendor reports every campaign
32
+ * in one call (and one each for the campaigns that report leaves out).
33
+ */
34
+ export declare const campaignTotalsCost: (input: {
35
+ readonly max_campaigns: number;
36
+ readonly statuses: readonly string[];
37
+ }, price: Price) => number;
28
38
  export declare const listFields: (costPerCampaign: string) => {
29
39
  max_campaigns: z.ZodDefault<z.ZodNumber>;
30
40
  statuses: z.ZodDefault<z.ZodArray<z.ZodEnum<{
@@ -40,8 +50,6 @@ export interface CampaignLabel {
40
50
  /** The campaign's ref. */
41
51
  readonly campaign: string;
42
52
  readonly campaignName: string;
43
- /** @deprecated Use `campaignName`. Removed in 0.5.0. */
44
- readonly name: string;
45
53
  readonly status: CampaignStatus;
46
54
  readonly channel: "email" | "linkedin";
47
55
  readonly provider: string;
@@ -20,6 +20,25 @@ export interface InsightsExtension {
20
20
  }
21
21
  /** Runs one insight by its tool name or method name, with JSON input. Rejects with `Invalid` for an unknown name. */
22
22
  export declare const runInsightByName: (outbound: OutboundApi, name: string, input?: Json, options?: RunOptions) => Promise<InsightResult<Json>>;
23
+ /** What one run of an insight can cost, in vendor requests. */
24
+ export interface InsightCostEstimate {
25
+ /** The least it can send: what is refused before any request when over the cap. */
26
+ readonly min: number;
27
+ /** The most it can send without retries, every cap in its input reached. */
28
+ readonly max: number;
29
+ /** The cap it runs under when none is set. */
30
+ readonly defaultCap: number;
31
+ }
32
+ /**
33
+ * What an insight costs for this input on this instance, or `null` when the
34
+ * adapter declares no costs (a combined instance) or the insight states none.
35
+ * Throws `Invalid` for an unknown insight or an input its schema refuses.
36
+ *
37
+ * ```ts
38
+ * insightCost(outbound, "client_report"); // { min: 3, max: 226, defaultCap: 287 }
39
+ * ```
40
+ */
41
+ export declare const insightCost: (outbound: OutboundApi, name: string, input?: Json) => InsightCostEstimate | null;
23
42
  export interface ListedInsight {
24
43
  readonly name: string;
25
44
  readonly key: string;
@@ -121,6 +121,14 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
121
121
  max_links?: number | undefined;
122
122
  max_subject_chars?: number | undefined;
123
123
  spam_words?: string[] | undefined;
124
+ }>, import("./define.ts").InsightDefinition<"copyPreview", {
125
+ campaign: string;
126
+ lead: string | null;
127
+ max_leads: number;
128
+ }, import("./copy/copy-preview.ts").CopyPreview, {
129
+ campaign: string;
130
+ lead?: string | null | undefined;
131
+ max_leads?: number | undefined;
124
132
  }>, import("./define.ts").InsightDefinition<"copyReuse", {
125
133
  max_campaigns: number;
126
134
  min_sent: number;
@@ -142,11 +150,9 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
142
150
  }>, import("./define.ts").InsightDefinition<"domainHealth", {
143
151
  max_senders: number;
144
152
  max_spam_rate: number;
145
- spam_rate_threshold?: number | undefined;
146
153
  }, import("./senders/domain-health.ts").DomainHealth, {
147
154
  max_senders?: number | undefined;
148
155
  max_spam_rate?: number | undefined;
149
- spam_rate_threshold?: number | undefined;
150
156
  }>, import("./define.ts").InsightDefinition<"senderCapacity", {
151
157
  days: number;
152
158
  max_campaigns: number;
@@ -166,14 +172,12 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
166
172
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
167
173
  from: string | null;
168
174
  to: string | null;
169
- threshold?: number | undefined;
170
175
  }, import("./senders/bounce-watch.ts").BounceWatch, {
171
176
  include_senders?: boolean | undefined;
172
177
  max_bounce_rate?: number | undefined;
173
178
  max_campaigns?: number | undefined;
174
179
  max_senders_per_campaign?: number | undefined;
175
180
  min_sent?: number | undefined;
176
- threshold?: number | undefined;
177
181
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
178
182
  from?: string | null | undefined;
179
183
  to?: string | null | undefined;
@@ -226,7 +230,6 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
226
230
  min_weekly_hours: number;
227
231
  from: string | null;
228
232
  to: string | null;
229
- recent_days?: number | undefined;
230
233
  }, import("./ops/campaign-diagnosis.ts").CampaignDiagnosis, {
231
234
  campaign: string;
232
235
  days?: number | undefined;
@@ -238,7 +241,6 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
238
241
  min_reply_rate?: number | undefined;
239
242
  min_sent?: number | undefined;
240
243
  min_weekly_hours?: number | undefined;
241
- recent_days?: number | undefined;
242
244
  from?: string | null | undefined;
243
245
  to?: string | null | undefined;
244
246
  }>, import("./define.ts").InsightDefinition<"pipelineForecast", {
@@ -276,14 +278,14 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
276
278
  max_campaigns?: number | undefined;
277
279
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
278
280
  }>, import("./define.ts").InsightDefinition<"campaignRanking", {
279
- metric: "reply_rate" | "bounce_rate" | "positive_reply_rate";
281
+ metric: "bounce_rate" | "reply_rate" | "positive_reply_rate";
280
282
  min_sent: number;
281
283
  max_campaigns: number;
282
284
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
283
285
  from: string | null;
284
286
  to: string | null;
285
287
  }, import("./ops/campaign-ranking.ts").CampaignRanking, {
286
- metric?: "reply_rate" | "bounce_rate" | "positive_reply_rate" | undefined;
288
+ metric?: "bounce_rate" | "reply_rate" | "positive_reply_rate" | undefined;
287
289
  min_sent?: number | undefined;
288
290
  max_campaigns?: number | undefined;
289
291
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
@@ -326,7 +328,6 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
326
328
  runway_days: number;
327
329
  max_campaigns: number;
328
330
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
329
- top?: number | undefined;
330
331
  }, import("./ops/client-report.ts").ClientReport, {
331
332
  alpha?: number | undefined;
332
333
  anomaly_threshold?: number | undefined;
@@ -338,7 +339,6 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
338
339
  min_baseline_points?: number | undefined;
339
340
  min_sent?: number | undefined;
340
341
  runway_days?: number | undefined;
341
- top?: number | undefined;
342
342
  max_campaigns?: number | undefined;
343
343
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
344
344
  }>];
@@ -0,0 +1,35 @@
1
+ import type { OutboundApi } from "../internal/outbound/api.ts";
2
+ import type { InsightCost } from "./cost.ts";
3
+ export interface CapOptions {
4
+ /**
5
+ * The most vendor requests the whole insight may send, retries included,
6
+ * across every read it makes. Replaces the default cap, which is worked
7
+ * out from the input; `Infinity` removes it. A `maxRequestsPerCall` on the
8
+ * instance and `budget()` still apply under it.
9
+ */
10
+ readonly maxRequests?: number | undefined;
11
+ /**
12
+ * Set by the insight tools: the default cap is at most this much, and the
13
+ * messages name `capSetting`. Not for direct use.
14
+ */
15
+ readonly capCeiling?: number | undefined;
16
+ /** The setting a cap message tells the caller to raise. Not for direct use. */
17
+ readonly capSetting?: string | undefined;
18
+ }
19
+ /** What of an insight the cap needs. */
20
+ export interface Capped<Input> {
21
+ readonly name: string;
22
+ readonly cost?: InsightCost<Input> | undefined;
23
+ readonly scales?: string | undefined;
24
+ }
25
+ export interface RunCap {
26
+ /** The instance to read through: every request on it is counted. */
27
+ readonly outbound: OutboundApi;
28
+ /** Refuses the run when the least `count` campaigns cost is over what it may spend. */
29
+ readonly campaignsFound: (count: number) => void;
30
+ /** Throws the cap's own error when the cap stopped a read, else `error`. */
31
+ readonly failed: (cause: unknown) => never;
32
+ /** The note for a run that finished without reads the cap stopped. */
33
+ readonly shortNote: () => string | undefined;
34
+ }
35
+ export declare const runCap: <Input>(outbound: OutboundApi, spec: Capped<Input>, input: Input, options: CapOptions) => RunCap;
@@ -1,12 +1,9 @@
1
1
  import type { Measured } from "../ops/shared.ts";
2
- import type { Interval } from "../stats.ts";
3
2
  export interface BounceCounts extends Measured {
4
3
  readonly bounced: number;
5
4
  readonly sent: number;
6
5
  /** Bounced (`count`) divided by sent (`of`). `null` when nothing was sent. */
7
6
  readonly rate: number | null;
8
- /** @deprecated Use `low` and `high`, the Wilson interval of the rate. Removed in 0.5.0. */
9
- readonly interval: Interval | null;
10
7
  }
11
8
  export interface BounceSender extends BounceCounts {
12
9
  readonly sender: string;
@@ -16,8 +13,6 @@ export interface BounceSender extends BounceCounts {
16
13
  export interface BounceCampaign extends BounceCounts {
17
14
  readonly campaign: string;
18
15
  readonly campaignName: string;
19
- /** @deprecated Use `campaignName`. Removed in 0.5.0. */
20
- readonly name: string;
21
16
  readonly status: string;
22
17
  readonly finding: string;
23
18
  /**
@@ -30,8 +25,6 @@ export interface BounceCampaign extends BounceCounts {
30
25
  export interface BounceUnknown {
31
26
  readonly campaign: string;
32
27
  readonly campaignName: string;
33
- /** @deprecated Use `campaignName`. Removed in 0.5.0. */
34
- readonly name: string;
35
28
  readonly status: string;
36
29
  readonly reason: string;
37
30
  }
@@ -55,8 +48,6 @@ export interface BounceWatch {
55
48
  };
56
49
  /** The `max_bounce_rate` the campaigns were held to. */
57
50
  readonly maxBounceRate: number;
58
- /** @deprecated Use `maxBounceRate`. Removed in 0.5.0. */
59
- readonly threshold: number;
60
51
  readonly minSent: number;
61
52
  /**
62
53
  * Senders whose sent and bounce counts were read. `null` when senders were
@@ -73,14 +64,12 @@ export declare const bounceWatch: import("../define.ts").InsightDefinition<"boun
73
64
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
74
65
  from: string | null;
75
66
  to: string | null;
76
- threshold?: number | undefined;
77
67
  }, BounceWatch, {
78
68
  include_senders?: boolean | undefined;
79
69
  max_bounce_rate?: number | undefined;
80
70
  max_campaigns?: number | undefined;
81
71
  max_senders_per_campaign?: number | undefined;
82
72
  min_sent?: number | undefined;
83
- threshold?: number | undefined;
84
73
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
85
74
  from?: string | null | undefined;
86
75
  to?: string | null | undefined;
@@ -1,5 +1,4 @@
1
1
  import type { Measured } from "../ops/shared.ts";
2
- import type { Interval } from "../stats.ts";
3
2
  import type { DnsRecord } from "./read.ts";
4
3
  export type DomainRisk = "high" | "low" | "medium" | "unknown";
5
4
  export interface DomainMailbox {
@@ -18,10 +17,6 @@ export interface DomainWarmup extends Measured {
18
17
  readonly mailboxes: number;
19
18
  readonly sent: number | null;
20
19
  readonly spam: number | null;
21
- /** @deprecated Use `rate`: warmup emails in spam (`count`) over those sent (`of`). Removed in 0.5.0. */
22
- readonly spamRate: number | null;
23
- /** @deprecated Use `low` and `high`. Removed in 0.5.0. */
24
- readonly interval: Interval | null;
25
20
  }
26
21
  export interface DomainReport {
27
22
  readonly domain: string;
@@ -67,9 +62,7 @@ export interface DomainHealth {
67
62
  export declare const domainHealth: import("../define.ts").InsightDefinition<"domainHealth", {
68
63
  max_senders: number;
69
64
  max_spam_rate: number;
70
- spam_rate_threshold?: number | undefined;
71
65
  }, DomainHealth, {
72
66
  max_senders?: number | undefined;
73
67
  max_spam_rate?: number | undefined;
74
- spam_rate_threshold?: number | undefined;
75
68
  }>;
@@ -1,11 +1,9 @@
1
1
  export declare const SENDERS_INSIGHTS: readonly [import("../define.ts").InsightDefinition<"domainHealth", {
2
2
  max_senders: number;
3
3
  max_spam_rate: number;
4
- spam_rate_threshold?: number | undefined;
5
4
  }, import("./domain-health.ts").DomainHealth, {
6
5
  max_senders?: number | undefined;
7
6
  max_spam_rate?: number | undefined;
8
- spam_rate_threshold?: number | undefined;
9
7
  }>, import("../define.ts").InsightDefinition<"senderCapacity", {
10
8
  days: number;
11
9
  max_campaigns: number;
@@ -25,14 +23,12 @@ export declare const SENDERS_INSIGHTS: readonly [import("../define.ts").InsightD
25
23
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
26
24
  from: string | null;
27
25
  to: string | null;
28
- threshold?: number | undefined;
29
26
  }, import("./bounce-watch.ts").BounceWatch, {
30
27
  include_senders?: boolean | undefined;
31
28
  max_bounce_rate?: number | undefined;
32
29
  max_campaigns?: number | undefined;
33
30
  max_senders_per_campaign?: number | undefined;
34
31
  min_sent?: number | undefined;
35
- threshold?: number | undefined;
36
32
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
37
33
  from?: string | null | undefined;
38
34
  to?: string | null | undefined;
@@ -16,8 +16,6 @@ export type CampaignSenderIssue = "inactive_sender" | "no_sender" | "single_send
16
16
  export interface CampaignSenderRisk {
17
17
  readonly campaign: string;
18
18
  readonly campaignName: string;
19
- /** @deprecated Use `campaignName`. Removed in 0.5.0. */
20
- readonly name: string;
21
19
  readonly senders: number;
22
20
  readonly issues: readonly CampaignSenderIssue[];
23
21
  /** The campaign's senders whose status is not active. */
@@ -3,7 +3,17 @@ import type { OutboundTool } from "../tools/index.ts";
3
3
  export interface InsightToolsOptions {
4
4
  /** Offer only these insights, by tool name. Defaults to every one the adapter can serve. */
5
5
  readonly only?: readonly string[] | undefined;
6
+ /**
7
+ * The most vendor requests one tool call may send, retries included,
8
+ * across every read the insight makes. Without it a call may send what its
9
+ * input can cost (the insight's default cap), but never more than 500, so a
10
+ * model cannot buy a larger cap by raising a `max_*` input. `Infinity`
11
+ * removes the default.
12
+ */
13
+ readonly maxRequestsPerToolCall?: number | undefined;
6
14
  }
15
+ /** The most an insight tool call may send when no cap is set, whatever its input. */
16
+ export declare const INSIGHT_TOOL_CEILING = 500;
7
17
  /**
8
18
  * The insights this instance can serve, as tools. An insight whose adapter
9
19
  * lacks a capability or a field it needs, or that cannot match records while the redact
@@ -1,4 +1,4 @@
1
- export type { CheckCount, CheckName, CopyAudit, CopyFinding, CopyPiece, CopyReuse, CopyUse, FunnelStep, FunnelVariant, HourCount, ReplyTiming, ReusedCopy, Severity, StepFunnel, TestedVariant, TimeTable, VariantStepTest, VariantTest, VariantVerdict, WeekdayCount, } from "./copy/index.ts";
1
+ export type { CheckCount, CheckName, CopyAudit, CopyFinding, CopyPiece, CopyPreview, CopyText, CopyReuse, CopyUse, FunnelStep, FunnelVariant, HourCount, PreviewLead, PreviewStep, PreviewVariant, RenderedCopy, ReplyTiming, ReusedCopy, Severity, StepFunnel, TestedVariant, TimeTable, VariantStepTest, VariantTest, VariantVerdict, WeekdayCount, } from "./copy/index.ts";
2
2
  export type { ActionItem, Anomalies, Anomaly, AnomalyMetric, BounceProblem, CampaignComparison, CampaignDiagnosis, CampaignLabel, CampaignRanking, ChannelComparison, ChannelGroup, ChannelMix, ClientReport, Comparison, DayRange, DiagnosisCode, DiagnosisFinding, Estimate, LeadRunway, Measured, MetricCoverage, OpenRange, PeriodComparison, PeriodNumbers, PipelineForecast, ProviderGroup, RankedCampaign, RankingGap, RankingMetric, Rates, TagGroup, TagRollup, ThinCampaign, Totals, UnrankedCampaign, } from "./ops/index.ts";
3
3
  export type { AccountPerson, AccountRecord, AccountSummary, CollisionCampaign, CopyVariable, DroppedReplies, DroppedReply, GapLead, HotLead, HotLeadParts, HotLeads, LeadCollision, LeadCollisions, PersonCampaign, PersonSummary, PersonalizationGaps, SuppressionCampaign, SuppressionCheck, SuppressionMatch, SuppressionViolation, VariableUse, } from "./people/index.ts";
4
4
  export type { AuditedCampaign, BounceCampaign, BounceCounts, BounceSender, BounceUnknown, BounceWatch, CampaignSenderIssue, CampaignSenderRisk, CapacityAsk, CapacitySends, CapacityTotals, DnsRecord, DomainHealth, DomainMailbox, DomainReport, DomainRisk, DomainWarmup, LinkedinSeat, LoadedSender, OverusedSender, ReadinessCounts, ReadinessReason, SenderCapacity, SenderLoad, SettingsAudit, SettingsCheck, SettingsCheckCounts, SettingsFinding, SettingsSeverity, ShortCampaign, UnreadySender, WarmupReadiness, } from "./senders/index.ts";
@@ -0,0 +1,33 @@
1
+ import type { Lead } from "../internal/entities.ts";
2
+ /** A variable's name lowercased, without spaces, underscores and hyphens. */
3
+ export declare const keyOf: (name: string) => string;
4
+ export declare const isBuiltin: (key: string) => boolean;
5
+ export interface VariableMatch {
6
+ /** The name as the copy writes it. */
7
+ readonly name: string;
8
+ /** The text after the `|`, or `null` when the variable has no fallback. */
9
+ readonly fallback: string | null;
10
+ /** The variable exactly as it appears in the copy. */
11
+ readonly raw: string;
12
+ readonly index: number;
13
+ }
14
+ /** Every variable in one text, in the order the patterns find them. */
15
+ export declare const variablesIn: (text: string) => VariableMatch[];
16
+ /**
17
+ * The lead's value for a variable: a built-in field, or a custom field of
18
+ * the same name without regard to case, spaces, underscores or hyphens.
19
+ * `null` when the lead has none or it is blank.
20
+ */
21
+ export declare const valueOf: (lead: Lead, key: string) => string | null;
22
+ /** Every variable key a lead has a non-empty value for. */
23
+ export declare const keysWithValue: (lead: Lead) => Set<string>;
24
+ export interface Filled {
25
+ readonly text: string;
26
+ /** Variables left as written: no value and no fallback, as the copy writes them. */
27
+ readonly unfilled: readonly string[];
28
+ }
29
+ /**
30
+ * `text` with each variable replaced by the lead's value, or its fallback
31
+ * when the lead has none. A variable with neither is left as written.
32
+ */
33
+ export declare const fillVariables: (text: string, lead: Lead) => Filled;
@@ -20,6 +20,7 @@ export declare const costs: {
20
20
  "blocklist.list": {
21
21
  pageSize: number;
22
22
  perPage: number;
23
+ perWalk: number;
23
24
  };
24
25
  "campaigns.get": {
25
26
  perPage: number;
@@ -27,28 +28,36 @@ export declare const costs: {
27
28
  "campaigns.list": {
28
29
  pageSize: number;
29
30
  perPage: number;
31
+ perWalk: number;
30
32
  };
31
33
  "campaigns.settings": {
32
34
  perPage: number;
33
35
  };
34
36
  "leads.get": {
35
37
  perPage: number;
38
+ perWalk: number;
36
39
  };
37
40
  "leads.list": {
38
41
  pageSize: number;
39
42
  perPage: number;
43
+ perPageAtMost: number;
44
+ perWalk: number;
40
45
  };
41
46
  "lists.list": {
42
47
  pageSize: number;
43
48
  perPage: number;
49
+ perWalk: number;
44
50
  };
45
51
  "messages.list": {
46
52
  pageSize: number;
47
53
  perPage: number;
54
+ perWalk: number;
48
55
  };
49
56
  "replies.list": {
50
57
  pageSize: number;
51
58
  perPage: number;
59
+ perPageAtMost: number;
60
+ perWalk: number;
52
61
  };
53
62
  "senders.get": {
54
63
  perPage: number;
@@ -59,6 +68,7 @@ export declare const costs: {
59
68
  "senders.list": {
60
69
  pageSize: number;
61
70
  perPage: number;
71
+ perWalk: number;
62
72
  };
63
73
  "sequence.get": {
64
74
  perPage: number;
@@ -66,6 +76,7 @@ export declare const costs: {
66
76
  "sequence.subsequences": {
67
77
  pageSize: number;
68
78
  perPage: number;
79
+ perWalk: number;
69
80
  };
70
81
  stats: {
71
82
  perPage: number;
@@ -73,10 +84,12 @@ export declare const costs: {
73
84
  "tags.list": {
74
85
  pageSize: number;
75
86
  perPage: number;
87
+ perWalk: number;
76
88
  };
77
89
  "webhooks.list": {
78
90
  pageSize: number;
79
91
  perPage: number;
92
+ perWalk: number;
80
93
  };
81
94
  "workspaces.list": {
82
95
  perPage: number;