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
@@ -0,0 +1,35 @@
1
+ import type { OperationCost } from "./adapter.ts";
2
+ import type { OutboundApi } from "./outbound/api.ts";
3
+ import type { OutboundPlugin } from "./outbound/plugins.ts";
4
+ export declare const CAPPED: unique symbol;
5
+ /** Counts requests as they are sent, and stops one that would pass the cap. */
6
+ export interface RequestGuard {
7
+ /** Throws when no request is left. Runs before the request is sent. */
8
+ readonly check: (provider: string) => void;
9
+ /** Counts the request being sent. */
10
+ readonly count: () => void;
11
+ }
12
+ export interface CappedAccess {
13
+ /** What the adapter's reads cost, or `undefined` when it declares none. */
14
+ readonly costs: Readonly<Record<string, OperationCost>> | undefined;
15
+ /** The same instance with `layer` innermost, kept out of `plugins`. */
16
+ readonly guarded: (layer: OutboundPlugin) => OutboundApi;
17
+ }
18
+ /** What an instance built by `createOutbound` offers for a shared cap; `undefined` on anything else. */
19
+ export declare const cappedAccess: (outbound: OutboundApi) => CappedAccess | undefined;
20
+ export interface RequestCounter extends RequestGuard {
21
+ /** Requests counted so far. */
22
+ readonly used: () => number;
23
+ /** `true` once a request was stopped at the cap. */
24
+ readonly stopped: () => boolean;
25
+ }
26
+ /**
27
+ * Allows `cap` requests in all. `stop` builds the error for the request that
28
+ * would pass it. `Infinity` counts without stopping.
29
+ */
30
+ export declare const requestCounter: (cap: number, stop: (provider: string) => Error) => RequestCounter;
31
+ /**
32
+ * `outbound` with every request counted by `guard`. An instance not built by
33
+ * `createOutbound` is returned as it is: there is nothing to count through.
34
+ */
35
+ export declare const withGuard: <Api extends OutboundApi>(outbound: Api, guard: RequestGuard) => Api;
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ /** Bumped only for a breaking change to the shapes in entities.ts. */
3
+ export declare const SCHEMA_VERSION: 1;
4
+ export declare const campaignStatusSchema: z.ZodEnum<{
5
+ active: "active";
6
+ archived: "archived";
7
+ completed: "completed";
8
+ draft: "draft";
9
+ paused: "paused";
10
+ unknown: "unknown";
11
+ }>;
12
+ export declare const replyCategorySchema: z.ZodEnum<{
13
+ unknown: "unknown";
14
+ bounce: "bounce";
15
+ negative: "negative";
16
+ neutral: "neutral";
17
+ ooo: "ooo";
18
+ positive: "positive";
19
+ unsubscribe: "unsubscribe";
20
+ }>;
@@ -3,11 +3,11 @@ import {
3
3
  configuredProviders,
4
4
  fromEnv,
5
5
  loadableProviders
6
- } from "../chunks/chunk-RCZ7ZZFU.js";
7
- import "../chunks/chunk-IPUYZD4O.js";
8
- import "../chunks/chunk-XC6CZP73.js";
9
- import "../chunks/chunk-E7JHLNLG.js";
10
- import "../chunks/chunk-VQSCHOBV.js";
6
+ } from "../chunks/chunk-5J7GGV62.js";
7
+ import "../chunks/chunk-GFDNRWR3.js";
8
+ import "../chunks/chunk-J7DDZ4C2.js";
9
+ import "../chunks/chunk-BLCJHP5H.js";
10
+ import "../chunks/chunk-WH6V3YNN.js";
11
11
  export {
12
12
  ALL_PROVIDERS,
13
13
  configuredProviders,
@@ -1,5 +1,6 @@
1
1
  import type { Adapter } from "../internal/adapter.ts";
2
2
  import type { CapabilityDeclaration } from "../internal/capabilities.ts";
3
+ import type { FieldDeclaration } from "../internal/fields.ts";
3
4
  import type { MemoryData } from "./data.ts";
4
5
  export interface MemoryOptions {
5
6
  readonly data?: MemoryData | undefined;
@@ -11,6 +12,12 @@ export interface MemoryOptions {
11
12
  readonly pageSize?: number | undefined;
12
13
  /** Overrides what the adapter declares, to exercise gating and fallbacks. */
13
14
  readonly capabilities?: CapabilityDeclaration | undefined;
15
+ /**
16
+ * The fields this adapter says it never fills, as a vendor adapter declares
17
+ * them, for example `{ campaign: { tags: false } }` to act like a tool whose
18
+ * campaigns have no tags. Defaults to every field filled.
19
+ */
20
+ readonly fields?: FieldDeclaration | undefined;
14
21
  }
15
22
  /** An adapter over data held in memory. */
16
23
  export declare const memory: (options?: MemoryOptions) => Adapter;
@@ -0,0 +1,3 @@
1
+ import type { MemoryStats } from "./data.ts";
2
+ /** Every demo stats row, dated by `day(n)`: `n` days before `now`. */
3
+ export declare const demoStats: (day: (days: number) => string) => MemoryStats[];
@@ -1,7 +1,18 @@
1
1
  import type { MemoryData } from "./data.ts";
2
+ export interface DemoDataOptions {
3
+ /**
4
+ * The moment the data is built for: every date is counted back from its
5
+ * day. Defaults to now. Pass a fixed time for output that never changes.
6
+ */
7
+ readonly now?: Date | number | string | undefined;
8
+ }
2
9
  /**
3
10
  * A small made-up dataset for demos and docs: two campaigns, two mailboxes,
4
- * three leads, two days of stats, and one list, tag, webhook and block list
5
- * entry. No real people or companies.
11
+ * three leads, three messages, three weeks of daily stats split by step and
12
+ * variant, and one list, tag, webhook and block list entry. No real people
13
+ * or companies. Its dates sit in the weeks before `now`, so the reports over
14
+ * the last seven or fourteen days find data on any day it is called. Step 0
15
+ * of "Q4 SaaS founders" runs an A/B test, both campaigns share a follow-up,
16
+ * and four days before `now` bounces spike.
6
17
  */
7
- export declare const demoData: () => MemoryData;
18
+ export declare const demoData: (options?: DemoDataOptions) => MemoryData;
@@ -3,3 +3,4 @@ export type { MemoryOptions } from "./adapter.ts";
3
3
  export type { MemoryBlockEntry, MemoryHealth, MemoryList, MemorySettings, MemoryTag, MemoryWebhook, } from "./account.ts";
4
4
  export type { MemoryCampaign, MemoryData, MemoryLead, MemoryMessage, MemorySender, MemoryStats, MemoryStep, MemorySubsequence, MemoryVariant, } from "./data.ts";
5
5
  export { demoData } from "./demo.ts";
6
+ export type { DemoDataOptions } from "./demo.ts";
@@ -1,33 +1,35 @@
1
- import {
2
- emptyCounts,
3
- sumCounts
4
- } from "../chunks/chunk-YOTW5ESM.js";
5
- import {
6
- profileSlug
7
- } from "../chunks/chunk-NAWZ73QS.js";
8
- import {
9
- stableId
10
- } from "../chunks/chunk-FHKSLCVW.js";
11
1
  import {
12
2
  recordBase,
13
3
  refTo,
14
4
  refsTo
15
- } from "../chunks/chunk-U2D34ARZ.js";
5
+ } from "../chunks/chunk-2D42TQFU.js";
16
6
  import {
17
- SCHEMA_VERSION,
18
7
  leadProgressSchema
19
- } from "../chunks/chunk-4PSO6JEK.js";
8
+ } from "../chunks/chunk-BOWXGMN3.js";
9
+ import {
10
+ emptyCounts,
11
+ sumCounts
12
+ } from "../chunks/chunk-PQSTQKRD.js";
13
+ import {
14
+ SCHEMA_VERSION
15
+ } from "../chunks/chunk-QGRZDTX4.js";
20
16
  import {
21
17
  assertWorkspaceId,
22
18
  makeRef
23
- } from "../chunks/chunk-LVYG7XZJ.js";
19
+ } from "../chunks/chunk-QAKJ76HB.js";
20
+ import {
21
+ profileSlug
22
+ } from "../chunks/chunk-NAWZ73QS.js";
23
+ import {
24
+ stableId
25
+ } from "../chunks/chunk-FHKSLCVW.js";
24
26
  import {
25
27
  OutboundError,
26
28
  makeErrorMapper
27
- } from "../chunks/chunk-E7JHLNLG.js";
29
+ } from "../chunks/chunk-J7DDZ4C2.js";
28
30
  import {
29
31
  isNumber
30
- } from "../chunks/chunk-VQSCHOBV.js";
32
+ } from "../chunks/chunk-BLCJHP5H.js";
31
33
 
32
34
  // src/memory/account.ts
33
35
  var base = (identity, sourceId) => recordBase(identity, sourceId, null);
@@ -127,13 +129,13 @@ var toCampaign = (identity, seed) => ({
127
129
  status: seed.status ?? "active",
128
130
  tags: [...seed.tags ?? []]
129
131
  });
130
- var toSteps = (steps, channel) => steps.map((step, index) => ({
131
- action: step.action ?? (channel === "linkedin" ? "message" : "email"),
132
- branch: step.branch ?? null,
133
- delayDays: step.delayDays ?? null,
132
+ var toSteps = (steps, channel) => steps.map((step2, index) => ({
133
+ action: step2.action ?? (channel === "linkedin" ? "message" : "email"),
134
+ branch: step2.branch ?? null,
135
+ delayDays: step2.delayDays ?? null,
134
136
  index,
135
- parentIndex: step.parentIndex ?? (index === 0 ? null : index - 1),
136
- variants: step.variants.map((variant, variantIndex) => ({
137
+ parentIndex: step2.parentIndex ?? (index === 0 ? null : index - 1),
138
+ variants: step2.variants.map((variant, variantIndex) => ({
137
139
  body: variant.body ?? null,
138
140
  contentHash: stableId(variant.subject, variant.body),
139
141
  subject: variant.subject ?? null,
@@ -590,6 +592,7 @@ var memory = (options = {}) => {
590
592
  ...accountReads(store),
591
593
  capabilities,
592
594
  costs: {},
595
+ fields: options.fields,
593
596
  // Nothing is rate limited in memory; the numbers only keep the engine's math defined.
594
597
  limits: {
595
598
  source: "in-memory adapter, not a vendor limit",
@@ -609,10 +612,139 @@ var memory = (options = {}) => {
609
612
  };
610
613
  };
611
614
 
615
+ // src/memory/demo-stats.ts
616
+ var FOUNDERS = [
617
+ [15, 1, 15, 0, 14, 1, 1, 26, 1],
618
+ [14, 1, 16, 1, 15, 0, 1, 24, 0],
619
+ [16, 2, 14, 0, 15, 1, 2, 27, 1],
620
+ // The bounce spike.
621
+ [15, 1, 15, 0, 16, 0, 1, 22, 9],
622
+ [15, 0, 15, 1, 14, 1, 1, 25, 0],
623
+ [16, 1, 14, 0, 15, 0, 1, 26, 1],
624
+ [14, 1, 16, 0, 15, 1, 1, 23, 0],
625
+ // The week before: the same sends, and fewer replies (8 of 314, against
626
+ // 13 of 314 in the week above), so a weekly comparison has a change to show.
627
+ [15, 1, 15, 1, 14, 0, 2, 25, 1],
628
+ [16, 0, 15, 0, 15, 1, 0, 24, 0],
629
+ [15, 0, 14, 0, 16, 1, 1, 26, 1],
630
+ [14, 1, 15, 0, 15, 0, 1, 23, 0],
631
+ [15, 1, 16, 0, 14, 0, 1, 25, 1],
632
+ [16, 0, 15, 0, 15, 0, 0, 24, 0],
633
+ [15, 1, 14, 1, 15, 0, 1, 26, 1],
634
+ [14, 2, 15, 0, 16, 0, 1, 23, 0],
635
+ [15, 1, 16, 0, 15, 1, 1, 25, 1],
636
+ [16, 0, 14, 1, 14, 0, 0, 24, 0],
637
+ [15, 1, 15, 0, 15, 1, 1, 26, 1],
638
+ [14, 1, 16, 0, 16, 0, 1, 23, 0],
639
+ [15, 1, 15, 0, 15, 1, 1, 25, 1],
640
+ [16, 0, 14, 1, 14, 0, 0, 24, 0]
641
+ ];
642
+ var AGENCIES = [
643
+ [30, 1, 20, 0, 0, 18, 3],
644
+ [31, 0, 19, 0, 0, 17, 2],
645
+ [29, 0, 21, 1, 0, 19, 3],
646
+ [30, 1, 20, 0, 1, 18, 3],
647
+ [31, 0, 19, 1, 0, 17, 2],
648
+ [29, 1, 21, 0, 0, 19, 3],
649
+ [30, 0, 20, 1, 1, 18, 2],
650
+ // The week before: 3 replies from 350 sends, against 6 in the week above.
651
+ [30, 1, 20, 0, 0, 17, 3],
652
+ [31, 0, 19, 1, 0, 19, 2],
653
+ [29, 0, 21, 0, 0, 18, 3],
654
+ [30, 0, 20, 0, 0, 17, 2],
655
+ [31, 0, 19, 0, 0, 19, 3],
656
+ [29, 0, 21, 1, 1, 18, 2],
657
+ [30, 0, 20, 0, 0, 17, 3],
658
+ [31, 0, 19, 0, 0, 19, 2],
659
+ [29, 1, 21, 0, 0, 18, 3],
660
+ [30, 0, 20, 0, 0, 17, 2],
661
+ [30, 0, 20, 0, 0, 19, 3],
662
+ [31, 2, 19, 1, 1, 18, 2],
663
+ [29, 0, 21, 0, 0, 17, 3],
664
+ [30, 1, 20, 1, 0, 19, 2]
665
+ ];
666
+ var sumOf = (values) => values.reduce((sum, value) => sum + value, 0);
667
+ var rowsOf = (campaignId, date, steps, { bounced, opened, positive }) => {
668
+ const sent = sumOf(steps.map((step2) => step2.sent));
669
+ return [
670
+ {
671
+ campaignId,
672
+ counts: {
673
+ bounced,
674
+ // Step 0 is the first touch, so its sends are the leads contacted.
675
+ contacted: sumOf(
676
+ steps.flatMap((step2) => step2.stepIndex === 0 ? [step2.sent] : [])
677
+ ),
678
+ delivered: sent - bounced,
679
+ opened,
680
+ positive,
681
+ replied: sumOf(steps.map((step2) => step2.replied)),
682
+ sent
683
+ },
684
+ date
685
+ },
686
+ ...steps.map(({ replied, sent: stepSent, stepIndex, variantKey }) => ({
687
+ campaignId,
688
+ counts: { replied, sent: stepSent },
689
+ date,
690
+ stepIndex,
691
+ variantKey
692
+ }))
693
+ ];
694
+ };
695
+ var step = (stepIndex, variantKey, sent, replied) => ({ replied, sent, stepIndex, variantKey });
696
+ var demoStats = (day) => [
697
+ ...FOUNDERS.flatMap(
698
+ ([
699
+ a,
700
+ aReplied,
701
+ b,
702
+ bReplied,
703
+ follow,
704
+ followReplied,
705
+ positive,
706
+ opened,
707
+ bounced
708
+ ], index) => rowsOf(
709
+ "cmp_founders",
710
+ day(index + 1),
711
+ [
712
+ step(0, "A", a, aReplied),
713
+ step(0, "B", b, bReplied),
714
+ step(1, "A", follow, followReplied)
715
+ ],
716
+ { bounced, opened, positive }
717
+ )
718
+ ),
719
+ ...AGENCIES.flatMap(
720
+ ([first, firstReplied, follow, followReplied, positive, opened, bounced], index) => rowsOf(
721
+ "cmp_agencies",
722
+ day(index + 1),
723
+ [
724
+ step(0, "A", first, firstReplied),
725
+ step(1, "A", follow, followReplied)
726
+ ],
727
+ { bounced, opened, positive }
728
+ )
729
+ )
730
+ ];
731
+
612
732
  // src/memory/demo.ts
613
- var campaigns = [
733
+ var DAY = 864e5;
734
+ var clockAt = (now) => {
735
+ const today = Math.floor(now / DAY) * DAY;
736
+ const day = (days) => new Date(today - days * DAY).toISOString().slice(0, 10);
737
+ return {
738
+ at: (days, time) => `${day(days)}T${time}:00.000Z`,
739
+ day
740
+ };
741
+ };
742
+ var campaigns = ({
743
+ at,
744
+ day
745
+ }) => [
614
746
  {
615
- createdAt: "2026-10-01T09:00:00.000Z",
747
+ createdAt: at(23, "09:00"),
616
748
  id: "cmp_founders",
617
749
  name: "Q4 SaaS founders",
618
750
  settings: {
@@ -628,7 +760,7 @@ var campaigns = [
628
760
  to: "17:00"
629
761
  }
630
762
  ],
631
- startDate: "2026-10-05",
763
+ startDate: day(21),
632
764
  stopOnAutoReply: false,
633
765
  stopOnReply: true,
634
766
  trackClicks: false,
@@ -652,14 +784,14 @@ var campaigns = [
652
784
  {
653
785
  delayDays: 3,
654
786
  variants: [
655
- { body: "Following up on my note.", subject: "Re: Quick question" }
787
+ { body: "Following up on my note.", subject: "Following up" }
656
788
  ]
657
789
  }
658
790
  ],
659
791
  tags: ["client-a"]
660
792
  },
661
793
  {
662
- createdAt: "2026-09-12T09:00:00.000Z",
794
+ createdAt: at(30, "09:00"),
663
795
  id: "cmp_agencies",
664
796
  name: "Agency owners",
665
797
  status: "paused",
@@ -669,20 +801,27 @@ var campaigns = [
669
801
  variants: [
670
802
  { body: "Hello {{firstName}}.", subject: "Idea for {{company}}" }
671
803
  ]
804
+ },
805
+ // The same follow-up as "Q4 SaaS founders", so copy_reuse has copy to compare.
806
+ {
807
+ delayDays: 4,
808
+ variants: [
809
+ { body: "Following up on my note.", subject: "Following up" }
810
+ ]
672
811
  }
673
812
  ],
674
813
  tags: ["client-b"]
675
814
  }
676
815
  ];
677
- var leads = [
816
+ var leads = ({ at }) => [
678
817
  {
679
818
  campaignId: "cmp_founders",
680
819
  company: "Example Co",
681
- createdAt: "2026-10-02T10:00:00.000Z",
820
+ createdAt: at(15, "10:00"),
682
821
  email: "person1@example.com",
683
822
  engagement: {
684
- lastContactedAt: "2026-10-05T14:00:00.000Z",
685
- lastRepliedAt: "2026-10-06T09:30:00.000Z",
823
+ lastContactedAt: at(3, "14:00"),
824
+ lastRepliedAt: at(2, "09:30"),
686
825
  opens: 2,
687
826
  replies: 1,
688
827
  stepIndex: 0
@@ -698,7 +837,7 @@ var leads = [
698
837
  {
699
838
  campaignId: "cmp_founders",
700
839
  company: "Sample Ltd",
701
- createdAt: "2026-10-03T10:00:00.000Z",
840
+ createdAt: at(14, "10:00"),
702
841
  email: "person2@example.com",
703
842
  firstName: "Sam",
704
843
  id: "lead_2",
@@ -710,7 +849,7 @@ var leads = [
710
849
  {
711
850
  campaignId: "cmp_agencies",
712
851
  company: "Demo Agency",
713
- createdAt: "2026-09-13T10:00:00.000Z",
852
+ createdAt: at(25, "10:00"),
714
853
  email: "person3@example.com",
715
854
  firstName: "Dana",
716
855
  id: "lead_3",
@@ -719,7 +858,7 @@ var leads = [
719
858
  title: "Owner"
720
859
  }
721
860
  ];
722
- var messages = [
861
+ var messages = ({ at }) => [
723
862
  {
724
863
  body: "Hi Alex, saw your launch.",
725
864
  campaignId: "cmp_founders",
@@ -727,7 +866,7 @@ var messages = [
727
866
  id: "msg_1",
728
867
  leadId: "lead_1",
729
868
  senderId: "mbx_1",
730
- sentAt: "2026-10-05T14:00:00.000Z",
869
+ sentAt: at(3, "14:00"),
731
870
  stepIndex: 0,
732
871
  subject: "Quick question",
733
872
  threadId: "thr_1",
@@ -742,7 +881,7 @@ var messages = [
742
881
  isAuto: false,
743
882
  leadId: "lead_1",
744
883
  senderId: "mbx_1",
745
- sentAt: "2026-10-06T09:30:00.000Z",
884
+ sentAt: at(2, "09:30"),
746
885
  subject: "Re: Quick question",
747
886
  threadId: "thr_1"
748
887
  },
@@ -753,19 +892,19 @@ var messages = [
753
892
  id: "msg_3",
754
893
  leadId: "lead_2",
755
894
  senderId: "mbx_2",
756
- sentAt: "2026-10-05T14:05:00.000Z",
895
+ sentAt: at(3, "14:05"),
757
896
  stepIndex: 0,
758
897
  subject: "Congrats",
759
898
  variantKey: "B"
760
899
  }
761
900
  ];
762
- var senders = [
901
+ var senders = ({ at }) => [
763
902
  {
764
903
  address: "outreach1@example.com",
765
904
  campaignIds: ["cmp_founders"],
766
905
  dailyLimit: 40,
767
906
  health: {
768
- checkedAt: "2026-10-06T00:00:00.000Z",
907
+ checkedAt: at(2, "00:00"),
769
908
  connected: true,
770
909
  dkim: true,
771
910
  dmarc: true,
@@ -782,7 +921,7 @@ var senders = [
782
921
  campaignIds: ["cmp_founders", "cmp_agencies"],
783
922
  dailyLimit: 40,
784
923
  health: {
785
- checkedAt: "2026-10-06T00:00:00.000Z",
924
+ checkedAt: at(2, "00:00"),
786
925
  connected: true,
787
926
  dkim: false,
788
927
  dmarc: true,
@@ -796,71 +935,37 @@ var senders = [
796
935
  warmup: { enabled: true, score: 88 }
797
936
  }
798
937
  ];
799
- var stats = [
800
- {
801
- campaignId: "cmp_founders",
802
- counts: {
803
- bounced: 1,
804
- contacted: 50,
805
- delivered: 49,
806
- opened: 30,
807
- positive: 2,
808
- replied: 4,
809
- sent: 50
810
- },
811
- date: "2026-10-05"
812
- },
813
- {
814
- campaignId: "cmp_founders",
815
- counts: {
816
- bounced: 0,
817
- contacted: 40,
818
- delivered: 40,
819
- opened: 22,
820
- positive: 1,
821
- replied: 3,
822
- sent: 40
823
- },
824
- date: "2026-10-06"
825
- },
826
- {
827
- campaignId: "cmp_agencies",
828
- counts: {
829
- bounced: 4,
830
- contacted: 60,
831
- delivered: 56,
832
- opened: 18,
833
- positive: 0,
834
- replied: 1,
835
- sent: 60
836
- },
837
- date: "2026-10-05"
938
+ var demoData = (options = {}) => {
939
+ const now = options.now === void 0 ? Date.now() : new Date(options.now).getTime();
940
+ if (Number.isNaN(now)) {
941
+ throw new TypeError(`demoData: now is not a date: ${String(options.now)}`);
838
942
  }
839
- ];
840
- var demoData = () => ({
841
- blocklist: [{ id: "blk_1", value: "competitor.example" }],
842
- campaigns,
843
- lists: [
844
- {
845
- createdAt: "2026-09-30T09:00:00.000Z",
846
- id: "lst_founders",
847
- name: "SaaS founders"
848
- }
849
- ],
850
- tags: [{ description: "Work for client A", id: "tag_a", name: "client-a" }],
851
- webhooks: [
852
- {
853
- events: ["reply_received"],
854
- id: "wh_1",
855
- name: "Replies",
856
- url: "https://hooks.example.com/replies"
857
- }
858
- ],
859
- leads,
860
- messages,
861
- senders,
862
- stats
863
- });
943
+ const clock = clockAt(now);
944
+ return {
945
+ blocklist: [{ id: "blk_1", value: "competitor.example" }],
946
+ campaigns: campaigns(clock),
947
+ leads: leads(clock),
948
+ lists: [
949
+ {
950
+ createdAt: clock.at(24, "09:00"),
951
+ id: "lst_founders",
952
+ name: "SaaS founders"
953
+ }
954
+ ],
955
+ messages: messages(clock),
956
+ senders: senders(clock),
957
+ stats: demoStats(clock.day),
958
+ tags: [{ description: "Work for client A", id: "tag_a", name: "client-a" }],
959
+ webhooks: [
960
+ {
961
+ events: ["reply_received"],
962
+ id: "wh_1",
963
+ name: "Replies",
964
+ url: "https://hooks.example.com/replies"
965
+ }
966
+ ]
967
+ };
968
+ };
864
969
  export {
865
970
  demoData,
866
971
  memory
@@ -16,7 +16,99 @@ export interface ProviderInfo {
16
16
  /** The vendor's API documentation. */
17
17
  readonly docsUrl: string | null;
18
18
  }
19
+ declare const CATALOG: readonly [{
20
+ readonly channels: readonly ["email"];
21
+ readonly docsUrl: "https://developer.instantly.ai/";
22
+ readonly envVars: readonly [{
23
+ readonly description: "API V2 key. The all:read scope is enough.";
24
+ readonly name: "INSTANTLY_API_KEY";
25
+ readonly required: true;
26
+ }, {
27
+ readonly description: "A label for this client or workspace.";
28
+ readonly name: "INSTANTLY_WORKSPACE_ID";
29
+ readonly required: false;
30
+ }];
31
+ readonly id: "instantly";
32
+ readonly maturity: "beta";
33
+ readonly name: "Instantly";
34
+ readonly note: "Its reads were run, read-only, against one live workspace. Fixtures are built from the documentation.";
35
+ }, {
36
+ readonly channels: readonly ["email"];
37
+ readonly docsUrl: "https://api.smartlead.ai";
38
+ readonly envVars: readonly [{
39
+ readonly description: "API key. It is sent as a query parameter.";
40
+ readonly name: "SMARTLEAD_API_KEY";
41
+ readonly required: true;
42
+ }, {
43
+ readonly description: "A label for this client or workspace.";
44
+ readonly name: "SMARTLEAD_WORKSPACE_ID";
45
+ readonly required: false;
46
+ }];
47
+ readonly id: "smartlead";
48
+ readonly maturity: "unverified";
49
+ readonly name: "Smartlead";
50
+ readonly note: "Never run against a live account. Written from the public documentation and tested offline only.";
51
+ }, {
52
+ readonly channels: readonly ["linkedin"];
53
+ readonly docsUrl: "https://docs.heyreach.io/hey-reach-api.md";
54
+ readonly envVars: readonly [{
55
+ readonly description: "A workspace API key.";
56
+ readonly name: "HEYREACH_API_KEY";
57
+ readonly required: true;
58
+ }, {
59
+ readonly description: "A label for this client or workspace.";
60
+ readonly name: "HEYREACH_WORKSPACE_ID";
61
+ readonly required: false;
62
+ }];
63
+ readonly id: "heyreach";
64
+ readonly maturity: "beta";
65
+ readonly name: "HeyReach";
66
+ readonly note: "Its reads were run, read-only, against one live workspace. Fixtures are built from the documentation.";
67
+ }, {
68
+ readonly channels: readonly ["email"];
69
+ readonly docsUrl: "https://dedi.emailbison.com/api/reference";
70
+ readonly envVars: readonly [{
71
+ readonly description: "API key (an api-user key is scoped to one workspace).";
72
+ readonly name: "EMAILBISON_API_KEY";
73
+ readonly required: true;
74
+ }, {
75
+ readonly description: "The URL you log in to EmailBison with. Defaults to https://dedi.emailbison.com.";
76
+ readonly name: "EMAILBISON_BASE_URL";
77
+ readonly required: false;
78
+ }, {
79
+ readonly description: "A label for this client or workspace.";
80
+ readonly name: "EMAILBISON_WORKSPACE_ID";
81
+ readonly required: false;
82
+ }];
83
+ readonly id: "emailbison";
84
+ readonly maturity: "unverified";
85
+ readonly name: "EmailBison";
86
+ readonly note: "Never run against a live account. Written from the public documentation and tested offline only.";
87
+ }, {
88
+ readonly channels: readonly ["email", "linkedin"];
89
+ readonly docsUrl: null;
90
+ readonly envVars: readonly [];
91
+ readonly id: "memory";
92
+ readonly maturity: "stable";
93
+ readonly name: "In-memory (tests and demos)";
94
+ readonly note: "Holds data in memory. For tests and demos; there is no vendor behind it.";
95
+ }];
96
+ /** The id of a provider in the catalog: `instantly`, `smartlead`, `heyreach`, `emailbison` or `memory`. */
97
+ export type ProviderId = (typeof CATALOG)[number]["id"];
19
98
  export declare const providers: readonly ProviderInfo[];
99
+ /**
100
+ * Whether a value is a provider id from the catalog, for checking a name that
101
+ * arrives as a string from a flag or an environment variable. A provider
102
+ * added to the catalog is accepted without a change here.
103
+ *
104
+ * ```ts
105
+ * if (value === ALL_PROVIDERS || isProviderId(value)) {
106
+ * await fromEnv({ provider: value });
107
+ * }
108
+ * ```
109
+ */
110
+ export declare const isProviderId: (value: unknown) => value is ProviderId;
20
111
  export declare const findProvider: (id: string) => ProviderInfo | undefined;
21
112
  /** The variable `outbound-sdk/loader` reads to pick an adapter. */
22
113
  export declare const PROVIDER_ENV = "OUTBOUND_SDK_PROVIDER";
114
+ export {};