outbound-sdk 0.2.1 → 0.5.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 (175) 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 +684 -20
  8. package/dist/alerts/plugin.d.ts +20 -3
  9. package/dist/audit/index.js +2 -2
  10. package/dist/benchmarks/index.js +5 -5
  11. package/dist/budget/index.d.ts +5 -2
  12. package/dist/budget/index.js +12 -10
  13. package/dist/cards/content.d.ts +6 -1
  14. package/dist/cards/format.d.ts +17 -2
  15. package/dist/cards/index.d.ts +1 -1
  16. package/dist/cards/index.js +298 -132
  17. package/dist/cards/parts.d.ts +9 -2
  18. package/dist/cards/render.d.ts +20 -3
  19. package/dist/chunks/{chunk-U2D34ARZ.js → chunk-2D42TQFU.js} +3 -3
  20. package/dist/chunks/{chunk-6CVZOUHB.js → chunk-3S32R2MH.js} +53 -63
  21. package/dist/chunks/chunk-4PA526S7.js +17 -0
  22. package/dist/chunks/{chunk-RCZ7ZZFU.js → chunk-5J7GGV62.js} +12 -5
  23. package/dist/chunks/chunk-6TKFISG4.js +676 -0
  24. package/dist/chunks/{chunk-AFU5E5QB.js → chunk-BK5SLY32.js} +104 -84
  25. package/dist/chunks/{chunk-VQSCHOBV.js → chunk-BLCJHP5H.js} +11 -4
  26. package/dist/chunks/{chunk-SBIZDCRY.js → chunk-BN6WCAWX.js} +7 -7
  27. package/dist/chunks/{chunk-4PSO6JEK.js → chunk-BOWXGMN3.js} +6 -21
  28. package/dist/chunks/{chunk-PURHK3JU.js → chunk-EHSJGQ5K.js} +8 -8
  29. package/dist/chunks/{chunk-IPUYZD4O.js → chunk-GFDNRWR3.js} +1 -1
  30. package/dist/chunks/chunk-HPNGSG5E.js +51 -0
  31. package/dist/chunks/chunk-HWHI4LFY.js +102 -0
  32. package/dist/chunks/{chunk-E7JHLNLG.js → chunk-J7DDZ4C2.js} +15 -2
  33. package/dist/chunks/{chunk-DJ2IUQEU.js → chunk-JWGSB7PT.js} +6 -6
  34. package/dist/chunks/{chunk-R3Y56YVF.js → chunk-OLPMBRXM.js} +4 -3
  35. package/dist/chunks/{chunk-YOTW5ESM.js → chunk-PQSTQKRD.js} +2 -2
  36. package/dist/chunks/chunk-PTZO4QXR.js +15 -0
  37. package/dist/chunks/{chunk-LVYG7XZJ.js → chunk-QAKJ76HB.js} +1 -1
  38. package/dist/chunks/chunk-QGRZDTX4.js +26 -0
  39. package/dist/chunks/chunk-WGW3ROLY.js +18 -0
  40. package/dist/chunks/{chunk-XC6CZP73.js → chunk-WH6V3YNN.js} +32 -1
  41. package/dist/chunks/{chunk-P3IJBJUI.js → chunk-X4RDBD4J.js} +296 -62
  42. package/dist/chunks/chunk-XL6LJVHJ.js +71 -0
  43. package/dist/chunks/{chunk-XNFESPZH.js → chunk-YYCT3NGV.js} +200 -39
  44. package/dist/chunks/{chunk-UAT3JSJZ.js → chunk-ZOAG2C6V.js} +2 -2
  45. package/dist/cli/bin.js +19 -30
  46. package/dist/cli/commands.d.ts +11 -0
  47. package/dist/cli/index.d.ts +3 -0
  48. package/dist/cli/index.js +18 -13
  49. package/dist/cli/mcp.d.ts +5 -0
  50. package/dist/cli/update.d.ts +15 -0
  51. package/dist/clients/index.d.ts +1 -1
  52. package/dist/clients/index.js +35 -10
  53. package/dist/clients/plugin.d.ts +9 -2
  54. package/dist/combine/index.js +7 -6
  55. package/dist/emailbison/account.d.ts +7 -0
  56. package/dist/emailbison/adapter.d.ts +5 -0
  57. package/dist/emailbison/capabilities.d.ts +78 -0
  58. package/dist/emailbison/client.d.ts +29 -0
  59. package/dist/emailbison/index.d.ts +30 -0
  60. package/dist/emailbison/index.js +1017 -0
  61. package/dist/emailbison/mail.d.ts +5 -0
  62. package/dist/emailbison/map-mail.d.ts +13 -0
  63. package/dist/emailbison/map-sequence.d.ts +12 -0
  64. package/dist/emailbison/map-stats.d.ts +47 -0
  65. package/dist/emailbison/map.d.ts +24 -0
  66. package/dist/emailbison/native-params.d.ts +5 -0
  67. package/dist/emailbison/native-workspace.d.ts +167 -0
  68. package/dist/emailbison/native.d.ts +327 -0
  69. package/dist/emailbison/stats.d.ts +4 -0
  70. package/dist/emailbison/webhooks.d.ts +2 -0
  71. package/dist/exporter/index.d.ts +5 -2
  72. package/dist/exporter/index.js +2 -2
  73. package/dist/failover/index.js +3 -3
  74. package/dist/fixtures/index.js +10 -9
  75. package/dist/heyreach/capabilities.d.ts +3 -0
  76. package/dist/heyreach/client.d.ts +2 -0
  77. package/dist/heyreach/index.js +83 -51
  78. package/dist/heyreach/map.d.ts +5 -2
  79. package/dist/identity/index.js +33 -17
  80. package/dist/identity/plugin.d.ts +2 -0
  81. package/dist/index.d.ts +2 -2
  82. package/dist/index.js +29 -25
  83. package/dist/insights/campaign.d.ts +3 -0
  84. package/dist/insights/capped.d.ts +29 -0
  85. package/dist/insights/copy/copy-audit.d.ts +2 -0
  86. package/dist/insights/copy/copy-reuse.d.ts +27 -3
  87. package/dist/insights/copy/index.d.ts +8 -8
  88. package/dist/insights/copy/reply-timing.d.ts +8 -0
  89. package/dist/insights/copy/reuse-base.d.ts +32 -0
  90. package/dist/insights/copy/shared.d.ts +39 -15
  91. package/dist/insights/copy/step-funnel.d.ts +16 -5
  92. package/dist/insights/copy/variant-test.d.ts +19 -8
  93. package/dist/insights/cost.d.ts +91 -0
  94. package/dist/insights/define.d.ts +78 -3
  95. package/dist/insights/fields.d.ts +16 -0
  96. package/dist/insights/index.d.ts +6 -4
  97. package/dist/insights/index.js +1816 -748
  98. package/dist/insights/inputs.generated.d.ts +951 -0
  99. package/dist/insights/ops/campaign-diagnosis.d.ts +3 -1
  100. package/dist/insights/ops/campaign-ranking.d.ts +15 -7
  101. package/dist/insights/ops/channel-mix.d.ts +2 -1
  102. package/dist/insights/ops/client-report.d.ts +18 -5
  103. package/dist/insights/ops/index.d.ts +8 -4
  104. package/dist/insights/ops/period-comparison.d.ts +14 -3
  105. package/dist/insights/ops/pipeline-forecast.d.ts +14 -4
  106. package/dist/insights/ops/shared.d.ts +39 -24
  107. package/dist/insights/ops/tag-rollup.d.ts +2 -1
  108. package/dist/insights/people/account-summary.d.ts +13 -0
  109. package/dist/insights/people/dropped-replies.d.ts +8 -0
  110. package/dist/insights/people/find.d.ts +7 -1
  111. package/dist/insights/people/hot-leads.d.ts +16 -1
  112. package/dist/insights/people/person-summary.d.ts +6 -0
  113. package/dist/insights/people/read.d.ts +26 -10
  114. package/dist/insights/people/suppression-check.d.ts +11 -2
  115. package/dist/insights/plugin.d.ts +26 -5
  116. package/dist/insights/ref.d.ts +6 -0
  117. package/dist/insights/registry.d.ts +30 -18
  118. package/dist/insights/run-cap.d.ts +35 -0
  119. package/dist/insights/senders/bounce-watch.d.ts +25 -8
  120. package/dist/insights/senders/capacity-sends.d.ts +22 -0
  121. package/dist/insights/senders/domain-health.d.ts +10 -4
  122. package/dist/insights/senders/index.d.ts +14 -6
  123. package/dist/insights/senders/read.d.ts +15 -14
  124. package/dist/insights/senders/sender-capacity.d.ts +5 -13
  125. package/dist/insights/senders/sender-load.d.ts +2 -0
  126. package/dist/insights/stats.d.ts +8 -0
  127. package/dist/insights/tools.d.ts +13 -2
  128. package/dist/instantly/capabilities.d.ts +13 -0
  129. package/dist/instantly/client.d.ts +2 -0
  130. package/dist/instantly/index.js +77 -49
  131. package/dist/instantly/map.d.ts +6 -2
  132. package/dist/internal/adapter.d.ts +12 -0
  133. package/dist/internal/engine/request.d.ts +5 -0
  134. package/dist/internal/entities.d.ts +3 -20
  135. package/dist/internal/errors.d.ts +44 -0
  136. package/dist/internal/fields.d.ts +1 -1
  137. package/dist/internal/json.d.ts +9 -2
  138. package/dist/internal/lists.d.ts +24 -0
  139. package/dist/internal/numbers.d.ts +8 -0
  140. package/dist/internal/outbound/collections.d.ts +4 -0
  141. package/dist/internal/outbound/create.d.ts +24 -3
  142. package/dist/internal/outbound/outbound.d.ts +18 -2
  143. package/dist/internal/outbound/validate.d.ts +4 -0
  144. package/dist/internal/outbound/walker.d.ts +3 -2
  145. package/dist/internal/plural.d.ts +12 -0
  146. package/dist/internal/renamed.d.ts +28 -0
  147. package/dist/internal/request-cap.d.ts +35 -0
  148. package/dist/internal/vocabulary.d.ts +20 -0
  149. package/dist/loader/index.js +5 -5
  150. package/dist/memory/adapter.d.ts +7 -0
  151. package/dist/memory/demo-stats.d.ts +3 -0
  152. package/dist/memory/demo.d.ts +14 -3
  153. package/dist/memory/index.d.ts +1 -0
  154. package/dist/memory/index.js +209 -104
  155. package/dist/providers/index.d.ts +92 -0
  156. package/dist/providers/index.js +3 -1
  157. package/dist/reconcile/index.js +5 -4
  158. package/dist/redact/index.js +13 -7
  159. package/dist/redact/plugin.d.ts +7 -0
  160. package/dist/smartlead/capabilities.d.ts +5 -0
  161. package/dist/smartlead/index.js +119 -66
  162. package/dist/smartlead/shared.d.ts +13 -0
  163. package/dist/sync/index.js +2 -2
  164. package/dist/tools/ai-sdk.js +10 -6
  165. package/dist/tools/campaign-tools.d.ts +1 -1
  166. package/dist/tools/claude-agent.js +10 -6
  167. package/dist/tools/index.d.ts +2 -2
  168. package/dist/tools/index.js +16 -9
  169. package/dist/tools/input-problem.d.ts +8 -0
  170. package/dist/tools/registry.d.ts +26 -2
  171. package/dist/tools/shared.d.ts +27 -1
  172. package/dist/tracing/index.js +2 -2
  173. package/dist/webhooks/index.js +22 -12
  174. package/package.json +8 -2
  175. package/dist/chunks/chunk-FKH5N47I.js +0 -40
@@ -2,22 +2,43 @@ import type { Json } from "../internal/json.ts";
2
2
  import type { OutboundApi } from "../internal/outbound/api.ts";
3
3
  import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
4
4
  import type { InsightResult, RunOptions } from "./define.ts";
5
+ import type { InsightInputs } from "./inputs.generated.ts";
5
6
  import type { AnyInsight } from "./registry.ts";
6
- type InputOf<Definition> = Definition extends {
7
- readonly given?: infer Given;
8
- } ? Given : never;
9
7
  type DataOf<Definition> = Definition extends {
10
8
  readonly run: (...args: never[]) => Promise<infer Data>;
11
9
  } ? Data : never;
12
- /** One method per insight: `outbound.insights.personSummary({ person })`. */
10
+ /**
11
+ * One method per insight: `outbound.insights.personSummary({ person })`. The
12
+ * input is the generated `InsightInputs` entry, which is the schema's input
13
+ * type with each field's default and range in its JSDoc.
14
+ */
13
15
  export type Insights = {
14
- readonly [Definition in AnyInsight as Definition["key"]]: (input: InputOf<Definition>, options?: RunOptions) => Promise<InsightResult<DataOf<Definition>>>;
16
+ readonly [Definition in AnyInsight as Definition["key"]]: (input: InsightInputs[Definition["key"]], options?: RunOptions) => Promise<InsightResult<DataOf<Definition>>>;
15
17
  };
16
18
  export interface InsightsExtension {
17
19
  readonly insights: Insights;
18
20
  }
19
21
  /** Runs one insight by its tool name or method name, with JSON input. Rejects with `Invalid` for an unknown name. */
20
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;
21
42
  export interface ListedInsight {
22
43
  readonly name: string;
23
44
  readonly key: string;
@@ -0,0 +1,6 @@
1
+ import type { OutboundApi } from "../internal/outbound/api.ts";
2
+ /**
3
+ * The ref of the record `id` names on this instance. A combined instance
4
+ * takes only refs, each of one of its tools, so its ids are kept as given.
5
+ */
6
+ export declare const refOf: (outbound: OutboundApi, id: string) => string;
@@ -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;
@@ -266,14 +276,14 @@ export declare const INSIGHTS: readonly [import("./define.ts").InsightDefinition
266
276
  max_campaigns?: number | undefined;
267
277
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | undefined;
268
278
  }>, import("./define.ts").InsightDefinition<"campaignRanking", {
269
- metric: "reply_rate" | "bounce_rate" | "positive_reply_rate";
279
+ metric: "bounce_rate" | "reply_rate" | "positive_reply_rate";
270
280
  min_sent: number;
271
281
  max_campaigns: number;
272
282
  statuses: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[];
273
283
  from: string | null;
274
284
  to: string | null;
275
285
  }, import("./ops/campaign-ranking.ts").CampaignRanking, {
276
- metric?: "reply_rate" | "bounce_rate" | "positive_reply_rate" | undefined;
286
+ metric?: "bounce_rate" | "reply_rate" | "positive_reply_rate" | undefined;
277
287
  min_sent?: number | undefined;
278
288
  max_campaigns?: number | undefined;
279
289
  statuses?: ("active" | "archived" | "completed" | "draft" | "paused" | "unknown")[] | 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;
@@ -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,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.6.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.6.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.6.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.6.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.6.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.6.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.6.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. */
@@ -3,11 +3,22 @@ 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
- * lacks a capability it needs is left out, so a model is never offered a tool
10
- * that cannot work.
19
+ * lacks a capability or a field it needs, or that cannot match records while the redact
20
+ * plugin masks what it matches on, is left out, so a model is never offered a
21
+ * tool that cannot work. A `next` hint naming a left-out insight is dropped.
11
22
  *
12
23
  * ```ts
13
24
  * openaiTools(outbound, { extra: insightTools(outbound) });
@@ -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;
@@ -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;