outbound-sdk 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/alerts/check-schema.d.ts +1 -1
  2. package/dist/alerts/index.js +6 -6
  3. package/dist/audit/index.js +2 -2
  4. package/dist/benchmarks/index.js +4 -4
  5. package/dist/budget/index.js +2 -2
  6. package/dist/cards/index.js +54 -44
  7. package/dist/chunks/{chunk-BLCJHP5H.js → chunk-45TXPJW7.js} +1 -0
  8. package/dist/chunks/chunk-4AVYRVN5.js +239 -0
  9. package/dist/chunks/{chunk-YYCT3NGV.js → chunk-65YAGEWZ.js} +24 -7
  10. package/dist/chunks/{chunk-3JOC5DGD.js → chunk-6NSCPTOY.js} +488 -127
  11. package/dist/chunks/{chunk-W22SDX6S.js → chunk-7I3EPR23.js} +3 -3
  12. package/dist/chunks/{chunk-MGR6HREO.js → chunk-BNDHEDHD.js} +2 -2
  13. package/dist/chunks/chunk-DNPNTD5W.js +81 -0
  14. package/dist/chunks/{chunk-53DCVFUB.js → chunk-FALWG5U3.js} +1 -0
  15. package/dist/chunks/{chunk-OLPMBRXM.js → chunk-GL7BABF2.js} +2 -2
  16. package/dist/chunks/{chunk-ZOAG2C6V.js → chunk-HIAK2GCI.js} +9 -2
  17. package/dist/chunks/{chunk-SXGCKCAR.js → chunk-I7DXXGNZ.js} +40 -9
  18. package/dist/chunks/{chunk-BK5SLY32.js → chunk-JRL3QRBS.js} +264 -76
  19. package/dist/chunks/{chunk-PHNQ3WC2.js → chunk-KTYTE2BU.js} +4 -3
  20. package/dist/chunks/{chunk-JWGSB7PT.js → chunk-LD6F46UT.js} +2 -2
  21. package/dist/chunks/{chunk-2D42TQFU.js → chunk-LVZGIKNF.js} +2 -2
  22. package/dist/chunks/{chunk-PQSTQKRD.js → chunk-M2VXGLLZ.js} +35 -2
  23. package/dist/chunks/{chunk-UWUPUMM2.js → chunk-MW4C6LTN.js} +2 -2
  24. package/dist/chunks/chunk-OK3GAZMT.js +51 -0
  25. package/dist/chunks/{chunk-BOWXGMN3.js → chunk-POBAY3TI.js} +80 -4
  26. package/dist/chunks/{chunk-J7DDZ4C2.js → chunk-QFC4ZHD3.js} +1 -1
  27. package/dist/chunks/{chunk-TFICTGM2.js → chunk-T5MJMW3R.js} +1 -1
  28. package/dist/chunks/{chunk-GFDNRWR3.js → chunk-UFQ4WMLU.js} +1 -1
  29. package/dist/chunks/{chunk-QAKJ76HB.js → chunk-YW6FFVSZ.js} +1 -1
  30. package/dist/cli/bin.js +14 -14
  31. package/dist/cli/by-name.d.ts +28 -0
  32. package/dist/cli/commands.d.ts +2 -1
  33. package/dist/cli/config.d.ts +3 -2
  34. package/dist/cli/envelope.d.ts +50 -0
  35. package/dist/cli/index.d.ts +5 -0
  36. package/dist/cli/index.js +13 -13
  37. package/dist/cli/listing.d.ts +13 -0
  38. package/dist/cli/native.d.ts +4 -0
  39. package/dist/cli/options.d.ts +88 -0
  40. package/dist/cli/output.d.ts +13 -1
  41. package/dist/cli/suggest.d.ts +10 -0
  42. package/dist/cli/update.d.ts +25 -2
  43. package/dist/clients/index.js +6 -6
  44. package/dist/combine/index.js +7 -7
  45. package/dist/emailbison/capabilities.d.ts +1 -0
  46. package/dist/emailbison/index.js +38 -14
  47. package/dist/emailbison/map-stats.d.ts +10 -0
  48. package/dist/exporter/index.js +2 -2
  49. package/dist/failover/index.js +2 -2
  50. package/dist/fixtures/index.js +4 -4
  51. package/dist/heyreach/capabilities.d.ts +3 -0
  52. package/dist/heyreach/index.js +34 -12
  53. package/dist/heyreach/map-account.d.ts +2 -2
  54. package/dist/identity/index.js +2 -2
  55. package/dist/index.js +9 -7
  56. package/dist/insights/copy/audit-samples.d.ts +24 -0
  57. package/dist/insights/copy/audit-variant.d.ts +34 -0
  58. package/dist/insights/copy/copy-audit.d.ts +26 -12
  59. package/dist/insights/copy/copy-preview.d.ts +16 -3
  60. package/dist/insights/copy/index.d.ts +6 -0
  61. package/dist/insights/copy/reply-timing.d.ts +4 -0
  62. package/dist/insights/copy/shared.d.ts +4 -1
  63. package/dist/insights/copy/step-funnel.d.ts +20 -6
  64. package/dist/insights/copy/variant-test.d.ts +2 -3
  65. package/dist/insights/index.js +1138 -589
  66. package/dist/insights/inputs.generated.d.ts +47 -11
  67. package/dist/insights/ops/campaign-diagnosis.d.ts +2 -0
  68. package/dist/insights/ops/diagnosis-checks.d.ts +20 -1
  69. package/dist/insights/ops/index.d.ts +2 -0
  70. package/dist/insights/ops/pipeline-forecast.d.ts +17 -6
  71. package/dist/insights/people/account-summary.d.ts +14 -1
  72. package/dist/insights/people/auto-replies.d.ts +14 -0
  73. package/dist/insights/people/dropped-replies.d.ts +1 -1
  74. package/dist/insights/people/hot-leads.d.ts +5 -1
  75. package/dist/insights/people/index.d.ts +4 -0
  76. package/dist/insights/people/lead-collisions.d.ts +11 -2
  77. package/dist/insights/people/person-summary.d.ts +19 -3
  78. package/dist/insights/people/personalization-gaps.d.ts +14 -8
  79. package/dist/insights/people/suppression-check.d.ts +9 -0
  80. package/dist/insights/registry.d.ts +12 -0
  81. package/dist/insights/step.d.ts +15 -0
  82. package/dist/insights/variables.d.ts +2 -0
  83. package/dist/instantly/capabilities.d.ts +4 -0
  84. package/dist/instantly/index.js +263 -53
  85. package/dist/instantly/map-stats.d.ts +4 -0
  86. package/dist/instantly/stats-tracking.d.ts +19 -0
  87. package/dist/instantly/thread.d.ts +9 -0
  88. package/dist/internal/adapter.d.ts +5 -0
  89. package/dist/internal/auto-reply.d.ts +20 -0
  90. package/dist/internal/capabilities.d.ts +2 -0
  91. package/dist/internal/entities-account.d.ts +1 -0
  92. package/dist/internal/entities.d.ts +79 -2
  93. package/dist/internal/fields.d.ts +37 -1
  94. package/dist/internal/metrics.d.ts +23 -1
  95. package/dist/internal/outbound/api.d.ts +2 -0
  96. package/dist/internal/records.d.ts +2 -2
  97. package/dist/internal/reply-people.d.ts +37 -0
  98. package/dist/internal/runway.d.ts +42 -0
  99. package/dist/internal/sender-screen.d.ts +9 -0
  100. package/dist/internal/tracking.d.ts +33 -0
  101. package/dist/loader/index.js +4 -4
  102. package/dist/memory/data.d.ts +2 -1
  103. package/dist/memory/index.js +23 -12
  104. package/dist/redact/index.js +3 -3
  105. package/dist/smartlead/capabilities.d.ts +4 -0
  106. package/dist/smartlead/index.js +152 -38
  107. package/dist/smartlead/map-account.d.ts +3 -0
  108. package/dist/smartlead/stats-tracking.d.ts +22 -0
  109. package/dist/sync/index.js +2 -2
  110. package/dist/tools/ai-sdk.js +8 -7
  111. package/dist/tools/by-name.d.ts +18 -0
  112. package/dist/tools/campaign-tools.d.ts +6 -2
  113. package/dist/tools/claude-agent.js +8 -7
  114. package/dist/tools/index.js +9 -8
  115. package/dist/tools/shared.d.ts +7 -0
  116. package/dist/tracing/index.js +2 -2
  117. package/dist/webhooks/index.js +12 -11
  118. package/package.json +1 -1
  119. package/dist/chunks/chunk-HWHI4LFY.js +0 -102
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  eventData,
3
3
  refTo
4
- } from "./chunk-2D42TQFU.js";
4
+ } from "./chunk-LVZGIKNF.js";
5
5
  import {
6
6
  SCHEMA_VERSION
7
7
  } from "./chunk-QGRZDTX4.js";
@@ -19,7 +19,7 @@ import {
19
19
  objects,
20
20
  text,
21
21
  timestamp
22
- } from "./chunk-BLCJHP5H.js";
22
+ } from "./chunk-45TXPJW7.js";
23
23
 
24
24
  // src/heyreach/webhooks.ts
25
25
  var EVENT_TYPES = /* @__PURE__ */ new Map([
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-QGRZDTX4.js";
4
4
  import {
5
5
  makeRef
6
- } from "./chunk-QAKJ76HB.js";
6
+ } from "./chunk-YW6FFVSZ.js";
7
7
  import {
8
8
  compactObject
9
- } from "./chunk-BLCJHP5H.js";
9
+ } from "./chunk-45TXPJW7.js";
10
10
 
11
11
  // src/internal/record.ts
12
12
  var recordBase = (identity, sourceId, raw) => ({
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-QGRZDTX4.js";
4
4
  import {
5
5
  makeRef
6
- } from "./chunk-QAKJ76HB.js";
6
+ } from "./chunk-YW6FFVSZ.js";
7
7
 
8
8
  // src/internal/metrics.ts
9
9
  var METRIC_DEFINITIONS = {
@@ -48,20 +48,28 @@ var computeRates = (row) => ({
48
48
  replyRate: perLead(row, row.replied),
49
49
  unsubscribeRate: perLead(row, row.unsubscribed)
50
50
  });
51
+ var CONTACTED_LEADS_LIMIT = 2;
52
+ var contactedBeyondLeads = (contacted, leads) => contacted !== null && leads !== null && leads !== void 0 && leads > 0 && contacted > leads * CONTACTED_LEADS_LIMIT;
51
53
  var COUNT_KEYS = [
52
54
  "bounced",
53
55
  "clicked",
54
56
  "clickedTotal",
57
+ "completed",
55
58
  "connectionsAccepted",
56
59
  "connectionsSent",
57
60
  "contacted",
58
61
  "delivered",
59
62
  "inmailsSent",
63
+ "leads",
60
64
  "opened",
61
65
  "openedTotal",
66
+ "opportunities",
67
+ "opportunityValue",
62
68
  "positive",
63
69
  "replied",
64
70
  "repliedAuto",
71
+ "repliedAutoTotal",
72
+ "repliedTotal",
65
73
  "sent",
66
74
  "unsubscribed"
67
75
  ];
@@ -69,16 +77,22 @@ var emptyCounts = () => ({
69
77
  bounced: null,
70
78
  clicked: null,
71
79
  clickedTotal: null,
80
+ completed: null,
72
81
  connectionsAccepted: null,
73
82
  connectionsSent: null,
74
83
  contacted: null,
75
84
  delivered: null,
76
85
  inmailsSent: null,
86
+ leads: null,
77
87
  opened: null,
78
88
  openedTotal: null,
89
+ opportunities: null,
90
+ opportunityValue: null,
79
91
  positive: null,
80
92
  replied: null,
81
93
  repliedAuto: null,
94
+ repliedAutoTotal: null,
95
+ repliedTotal: null,
82
96
  sent: null,
83
97
  unsubscribed: null
84
98
  });
@@ -87,13 +101,29 @@ var sumCounts = (rows) => {
87
101
  for (const row of rows) {
88
102
  for (const key of COUNT_KEYS) {
89
103
  const value = row[key];
90
- if (value !== null) {
104
+ if (value !== null && value !== void 0) {
91
105
  total[key] = (total[key] ?? 0) + value;
92
106
  }
93
107
  }
94
108
  }
95
109
  return total;
96
110
  };
111
+ var TRACKED_KEYS = [
112
+ "clicked",
113
+ "clickedTotal",
114
+ "opened",
115
+ "openedTotal"
116
+ ];
117
+ var sumMeasured = (rows) => {
118
+ const total = sumCounts(rows);
119
+ const sending = rows.filter((row) => (row.sent ?? 0) > 0);
120
+ for (const key of TRACKED_KEYS) {
121
+ if (total[key] !== null && sending.some((row) => row[key] === null || row[key] === void 0)) {
122
+ total[key] = null;
123
+ }
124
+ }
125
+ return total;
126
+ };
97
127
  var metricRow = (scope, counts, extra = {}) => ({
98
128
  ...counts,
99
129
  contentHash: null,
@@ -112,7 +142,10 @@ var metricRow = (scope, counts, extra = {}) => ({
112
142
  export {
113
143
  METRIC_DEFINITIONS,
114
144
  computeRates,
145
+ CONTACTED_LEADS_LIMIT,
146
+ contactedBeyondLeads,
115
147
  emptyCounts,
116
148
  sumCounts,
149
+ sumMeasured,
117
150
  metricRow
118
151
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  readEnv
3
- } from "./chunk-GFDNRWR3.js";
3
+ } from "./chunk-UFQ4WMLU.js";
4
4
  import {
5
5
  OutboundError
6
- } from "./chunk-J7DDZ4C2.js";
6
+ } from "./chunk-QFC4ZHD3.js";
7
7
  import {
8
8
  PROVIDER_ENV,
9
9
  providers
@@ -0,0 +1,51 @@
1
+ import {
2
+ htmlToText,
3
+ looksLikeHtml,
4
+ stripQuotedHistory
5
+ } from "./chunk-FALWG5U3.js";
6
+
7
+ // src/internal/auto-reply.ts
8
+ var AUTO_REPLY_WITHIN_MS = 6e4;
9
+ var MACHINE_SENDER = /^[^@]*(?:no-?reply|do-?not-?reply|auto-?respon|auto-?reply|mailer-daemon|postmaster)[^@]*@/iu;
10
+ var AUTOMATIC_SUBJECT = /^(?:(?:re|fw|fwd|aw|sv)\s*:\s*)*(?:ooo\b|out\s+of\s+(?:the\s+)?office\b|automatic\s+reply\b|auto(?:matic)?[-\s]?reply\b|autoreply\b|auto[-\s]?response\b|away\s+from\s+(?:the\s+)?office\b|undeliverable\b|delivery\s+status\s+notification\b)/iu;
11
+ var LEFT_SUBJECT = /\bis\s+no\s+longer\s+(?:at|with|employed)\b/iu;
12
+ var AUTOMATIC_BODY = [
13
+ /\bthis\s+is\s+an\s+auto(?:mated|matic)(?:ally\s+generated)?\s+(?:reply|response|message|email|notification)\b/iu,
14
+ /\b(?:i\s+am|i'm|i\s+will\s+be)\s+(?:currently\s+)?out\s+of\s+(?:the\s+)?office\s+(?:until|from|through|and\s+will|with\s+(?:limited|no))\b/iu,
15
+ /\b(?:i\s+am|i'm|i\s+will\s+be)\s+(?:currently\s+)?(?:on\s+(?:maternity|paternity|parental)\s+leave)\b/iu,
16
+ /\b(?:with|have)\s+(?:limited|no)\s+access\s+to\s+(?:my\s+)?e-?mail\b/iu,
17
+ /\bthis\s+(?:mailbox|inbox|e-?mail\s+address)\s+is\s+(?:not|no\s+longer)\s+(?:monitored|active|in\s+use)\b/iu,
18
+ /\bfor\s+(?:technical\s+)?support,?\s+please\s+(?:contact|email|e-mail|reach\s+out\s+to)\b/iu,
19
+ /\b(?:thank\s+you|thanks)\s+for\s+(?:your\s+)?(?:e-?mail|message)\.?\s+(?:we|our\s+team)\s+(?:have|has)\s+received\b/iu
20
+ ];
21
+ var LEFT_NOTICE = /\byour\s+contact\s+(?:with|at)\s+.{1,80}?\s+has\s+changed\b/iu;
22
+ var LEFT_BODY = [
23
+ LEFT_NOTICE,
24
+ /\b(?:is|are)\s+no\s+longer\s+(?:with|at|employed\s+(?:by|at|with))\b/iu,
25
+ /\bhas\s+(?:left|departed)\s+(?:the\s+company|the\s+organi[sz]ation|our\s+(?:company|organi[sz]ation|team))\b/iu
26
+ ];
27
+ var ownText = (body) => {
28
+ if (body === null) {
29
+ return "";
30
+ }
31
+ return stripQuotedHistory(looksLikeHtml(body) ? htmlToText(body) : body);
32
+ };
33
+ var detectAutoReply = (input) => {
34
+ const subject = input.subject ?? "";
35
+ const body = ownText(input.body);
36
+ const leftCompany = LEFT_SUBJECT.test(subject) || LEFT_BODY.some((rule) => rule.test(body));
37
+ const isAuto = LEFT_SUBJECT.test(subject) || LEFT_NOTICE.test(body) || MACHINE_SENDER.test(input.from ?? "") || AUTOMATIC_SUBJECT.test(subject) || AUTOMATIC_BODY.some((rule) => rule.test(body));
38
+ return { isAuto, leftCompany };
39
+ };
40
+ var answeredAtOnce = (sentAt, repliedAt) => {
41
+ if (sentAt === null || repliedAt === null) {
42
+ return false;
43
+ }
44
+ const gap = Date.parse(repliedAt) - Date.parse(sentAt);
45
+ return Number.isFinite(gap) && gap >= 0 && gap < AUTO_REPLY_WITHIN_MS;
46
+ };
47
+
48
+ export {
49
+ detectAutoReply,
50
+ answeredAtOnce
51
+ };
@@ -71,6 +71,11 @@ var mailProviderSchema = z.enum([
71
71
  "other",
72
72
  "smtp"
73
73
  ]);
74
+ var recipientMailProviderSchema = z.enum([
75
+ "google",
76
+ "microsoft",
77
+ "other"
78
+ ]);
74
79
  var senderSchema = z.object({
75
80
  ...base,
76
81
  /** Lowercased mailbox address. `null` for a LinkedIn seat. */
@@ -95,6 +100,7 @@ var leadStatusSchema = z.enum([
95
100
  "completed",
96
101
  "paused",
97
102
  "replied",
103
+ "skipped",
98
104
  "unknown",
99
105
  "unsubscribed"
100
106
  ]);
@@ -102,6 +108,7 @@ var leadProgressSchema = z.enum([
102
108
  "active",
103
109
  "completed",
104
110
  "paused",
111
+ "skipped",
105
112
  "unknown"
106
113
  ]);
107
114
  var leadEngagementSchema = z.object({
@@ -146,6 +153,12 @@ var leadSchema = z.object({
146
153
  phone: z.string().nullable(),
147
154
  /** Where the lead is in its sequence, whatever came back from it. */
148
155
  progress: leadProgressSchema,
156
+ /**
157
+ * Who hosts the lead's own mailbox, as the vendor detected it. `null` when
158
+ * the vendor has not detected it or does not say. Optional, so a lead built
159
+ * or stored before the field existed still matches the schema.
160
+ */
161
+ recipientMailProvider: recipientMailProviderSchema.nullable().optional(),
149
162
  /** `true` once the lead replied. `null` when the vendor does not say. */
150
163
  replied: z.boolean().nullable(),
151
164
  /**
@@ -176,9 +189,17 @@ var messageFields = {
176
189
  threadId: z.string().nullable(),
177
190
  variantKey: z.string().nullable()
178
191
  };
192
+ var autoSourceSchema = z.enum(["rule", "vendor"]);
193
+ var isAutoSource = autoSourceSchema.nullable().optional();
179
194
  var messageSchema = z.object({
180
195
  ...messageFields,
181
- direction: z.enum(["in", "out"])
196
+ direction: z.enum(["in", "out"]),
197
+ /**
198
+ * On a received message, `true` for an auto-reply and `false` when it is
199
+ * known not to be one. Absent or `null` when nothing says.
200
+ */
201
+ isAuto: z.boolean().nullable().optional(),
202
+ isAutoSource
182
203
  });
183
204
  var replySchema = z.object({
184
205
  ...messageFields,
@@ -190,8 +211,15 @@ var replySchema = z.object({
190
211
  */
191
212
  categorySource: z.enum(["lead", "rule", "vendor"]).nullable(),
192
213
  direction: z.literal("in"),
193
- /** `true` for an auto-reply, `null` when the vendor does not say. */
214
+ /** `true` for an auto-reply, `null` when neither the vendor nor a fixed rule says. */
194
215
  isAuto: z.boolean().nullable(),
216
+ isAutoSource,
217
+ /**
218
+ * `true` when the reply says the person left the company or that the
219
+ * contact changed ("is no longer with", "your contact with Acme has
220
+ * changed"). Absent or `null` when nothing says.
221
+ */
222
+ leftCompany: z.boolean().nullable().optional(),
195
223
  /** `true` while the reply, or the thread it is in, is unread in the vendor's inbox. */
196
224
  unread: z.boolean().nullable()
197
225
  });
@@ -202,6 +230,11 @@ var metricScopeSchema = z.enum([
202
230
  "workspace"
203
231
  ]);
204
232
  var evidenceSchema = z.enum(["derived", "exact", "sampled"]);
233
+ var trackingStateSchema = z.enum(["mixed", "off", "on"]).nullable();
234
+ var trackingSchema = z.object({
235
+ clicks: trackingStateSchema,
236
+ opens: trackingStateSchema
237
+ });
205
238
  var metricRowSchema = z.object({
206
239
  bounced: count,
207
240
  /** Unique clicks: leads who clicked at least once. */
@@ -212,6 +245,11 @@ var metricRowSchema = z.object({
212
245
  connectionsAccepted: count,
213
246
  /** LinkedIn only. */
214
247
  connectionsSent: count,
248
+ /**
249
+ * Leads who reached the end of the sequence. Optional: absent or `null`
250
+ * where the vendor does not report it.
251
+ */
252
+ completed: count.optional(),
215
253
  /** Unique leads contacted. */
216
254
  contacted: count,
217
255
  contentHash: z.string().nullable(),
@@ -221,14 +259,43 @@ var metricRowSchema = z.object({
221
259
  evidence: evidenceSchema,
222
260
  /** LinkedIn only. */
223
261
  inmailsSent: count,
224
- /** Unique opens. `null` when open tracking is off. */
262
+ /**
263
+ * Leads in the campaign now, whatever their progress. A lead removed after
264
+ * its sequence started is still in `contacted`, so `contacted` can be a
265
+ * little over `leads`. Optional, like `completed`.
266
+ */
267
+ leads: count.optional(),
268
+ /**
269
+ * Unique opens. `null` when a campaign behind the row had open tracking
270
+ * off and recorded no opens, including when tracking is `mixed`.
271
+ */
225
272
  opened: count,
226
273
  openedTotal: count,
274
+ /** Opportunities the vendor counts for the leads. Optional, like `completed`. */
275
+ opportunities: count.optional(),
276
+ /**
277
+ * What those opportunities are worth, in the vendor workspace's own
278
+ * currency, which the vendor does not name. Optional, like `completed`.
279
+ */
280
+ opportunityValue: count.optional(),
227
281
  positive: count,
228
282
  provider: z.string().min(1),
229
- /** Replies from people. Auto-replies are counted in `repliedAuto`. */
283
+ /**
284
+ * People who replied, auto-replies left out: each lead is counted once,
285
+ * however many replies they sent. Auto-replies are counted in `repliedAuto`.
286
+ */
230
287
  replied: count,
288
+ /** People whose replies were automatic, counted once each. */
231
289
  repliedAuto: count,
290
+ /** Automatic reply messages, each one counted. Optional, like `repliedTotal`. */
291
+ repliedAutoTotal: count.optional(),
292
+ /**
293
+ * Reply messages from people, auto-replies left out: a lead who replied
294
+ * twice counts 2. Optional: absent or `null` where the vendor does not
295
+ * report it. Instantly's dashboard "Replies" is `repliedTotal` plus
296
+ * `repliedAutoTotal`.
297
+ */
298
+ repliedTotal: count.optional(),
232
299
  schemaVersion: z.literal(SCHEMA_VERSION),
233
300
  scope: metricScopeSchema,
234
301
  scopeRef: z.string(),
@@ -241,6 +308,14 @@ var metricRowSchema = z.object({
241
308
  * lifetime total. A vendor's "day" is not always UTC.
242
309
  */
243
310
  timezone: z.string().nullable(),
311
+ /**
312
+ * The open and click tracking of the campaigns behind the row, as their
313
+ * settings are now: `on`, `off`, `mixed` when some campaigns track and
314
+ * some do not, or `null` when a setting is unknown. Optional: absent when
315
+ * the adapter did not read the settings. A count the campaigns did not
316
+ * measure is `null`; see `docs/api/stats`.
317
+ */
318
+ tracking: trackingSchema.optional(),
244
319
  unsubscribed: count,
245
320
  variantKey: z.string().nullable(),
246
321
  workspaceId: z.string().min(1)
@@ -326,6 +401,7 @@ export {
326
401
  sequenceSchema,
327
402
  senderStatusSchema,
328
403
  mailProviderSchema,
404
+ recipientMailProviderSchema,
329
405
  senderSchema,
330
406
  leadStatusSchema,
331
407
  leadProgressSchema,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isJsonObject,
3
3
  isString
4
- } from "./chunk-BLCJHP5H.js";
4
+ } from "./chunk-45TXPJW7.js";
5
5
 
6
6
  // src/internal/redact.ts
7
7
  var EMAIL = /[\w.!#$%&'*+/=?^`{|}~-]+@[\w-]+(?:\.[\w-]+)+/gu;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-3JOC5DGD.js";
3
+ } from "./chunk-6NSCPTOY.js";
4
4
 
5
5
  // src/cli/bin.ts
6
6
  import process from "node:process";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OutboundError
3
- } from "./chunk-J7DDZ4C2.js";
3
+ } from "./chunk-QFC4ZHD3.js";
4
4
 
5
5
  // src/internal/env.ts
6
6
  var readEnv = (name) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OutboundError
3
- } from "./chunk-J7DDZ4C2.js";
3
+ } from "./chunk-QFC4ZHD3.js";
4
4
 
5
5
  // src/internal/ref.ts
6
6
  var SEPARATOR = ":";
package/dist/cli/bin.js CHANGED
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
- import "../chunks/chunk-TFICTGM2.js";
3
- import "../chunks/chunk-3JOC5DGD.js";
4
- import "../chunks/chunk-OLPMBRXM.js";
5
- import "../chunks/chunk-BK5SLY32.js";
6
- import "../chunks/chunk-HWHI4LFY.js";
2
+ import "../chunks/chunk-T5MJMW3R.js";
3
+ import "../chunks/chunk-6NSCPTOY.js";
4
+ import "../chunks/chunk-GL7BABF2.js";
5
+ import "../chunks/chunk-JRL3QRBS.js";
6
+ import "../chunks/chunk-4AVYRVN5.js";
7
7
  import "../chunks/chunk-4PA526S7.js";
8
8
  import "../chunks/chunk-HZCTYL22.js";
9
- import "../chunks/chunk-YYCT3NGV.js";
9
+ import "../chunks/chunk-65YAGEWZ.js";
10
10
  import "../chunks/chunk-4O2HRTTI.js";
11
11
  import "../chunks/chunk-HPNGSG5E.js";
12
- import "../chunks/chunk-ZOAG2C6V.js";
12
+ import "../chunks/chunk-HIAK2GCI.js";
13
13
  import "../chunks/chunk-PTZO4QXR.js";
14
- import "../chunks/chunk-BOWXGMN3.js";
15
- import "../chunks/chunk-PQSTQKRD.js";
14
+ import "../chunks/chunk-POBAY3TI.js";
15
+ import "../chunks/chunk-M2VXGLLZ.js";
16
16
  import "../chunks/chunk-QGRZDTX4.js";
17
- import "../chunks/chunk-QAKJ76HB.js";
17
+ import "../chunks/chunk-YW6FFVSZ.js";
18
18
  import "../chunks/chunk-NAWZ73QS.js";
19
19
  import "../chunks/chunk-FHKSLCVW.js";
20
- import "../chunks/chunk-UWUPUMM2.js";
21
- import "../chunks/chunk-GFDNRWR3.js";
22
- import "../chunks/chunk-J7DDZ4C2.js";
23
- import "../chunks/chunk-BLCJHP5H.js";
20
+ import "../chunks/chunk-MW4C6LTN.js";
21
+ import "../chunks/chunk-UFQ4WMLU.js";
22
+ import "../chunks/chunk-QFC4ZHD3.js";
23
+ import "../chunks/chunk-45TXPJW7.js";
24
24
  import "../chunks/chunk-WH6V3YNN.js";
@@ -0,0 +1,28 @@
1
+ import type { Campaign, CampaignStatus } from "../internal/entities.ts";
2
+ import type { OutboundApi } from "../internal/outbound/api.ts";
3
+ /** `--campaign` as the ref or id to read by, or `undefined` when not given. */
4
+ export declare const campaignOption: (outbound: OutboundApi, value: string | undefined) => Promise<string | undefined>;
5
+ /** `--list` as the ref or id to read by, or `undefined` when not given. */
6
+ export declare const listOption: (outbound: OutboundApi, value: string | undefined) => Promise<string | undefined>;
7
+ /**
8
+ * When `leads --campaign` or `--list` found no lead, reads the campaign or
9
+ * list itself, so one that does not exist fails with `NotFound` as
10
+ * `outbound campaign <id>` does, instead of printing an empty list. It costs
11
+ * a request only when the list came back empty.
12
+ */
13
+ export declare const confirmScope: (outbound: OutboundApi, scope: {
14
+ readonly campaignId?: string | undefined;
15
+ readonly listId?: string | undefined;
16
+ }, found: number) => Promise<void>;
17
+ export interface CampaignSearch {
18
+ readonly search: string;
19
+ readonly status: CampaignStatus | undefined;
20
+ readonly max: number;
21
+ /** Writes a line for the person to stderr. */
22
+ readonly note: (text: string) => void;
23
+ }
24
+ /**
25
+ * The campaigns whose name contains `search`, ignoring case. No vendor
26
+ * searches campaigns by name, so every campaign is read and matched here.
27
+ */
28
+ export declare const searchCampaigns: (outbound: OutboundApi, { max, note, search, status }: CampaignSearch) => Promise<Campaign[]>;
@@ -1,13 +1,14 @@
1
1
  import type { Json } from "../internal/json.ts";
2
2
  import type { OutboundApi } from "../internal/outbound/api.ts";
3
3
  import type { OutboundTool } from "../tools/index.ts";
4
+ import type { Printed } from "./envelope.ts";
4
5
  export interface CommandInput {
5
6
  readonly positionals: readonly string[];
6
7
  readonly flags: Readonly<Record<string, string | boolean | undefined>>;
7
8
  /** Writes a line for the person to stderr, apart from the JSON on stdout. */
8
9
  readonly note: (text: string) => void;
9
10
  }
10
- type Command = (outbound: OutboundApi, input: CommandInput) => Promise<Json>;
11
+ type Command = (outbound: OutboundApi, input: CommandInput) => Promise<Printed>;
11
12
  /** The tools `outbound mcp` offers: the built-in ones, then the insights. */
12
13
  export declare const offeredTools: (outbound: OutboundApi) => Promise<OutboundTool[]>;
13
14
  export interface CommandSpec {
@@ -17,6 +17,7 @@ export interface PluginFlags {
17
17
  * The plugins for one command, outermost first: redact, then the config
18
18
  * file's plugins, then cache, then budget, then identity, next to the
19
19
  * request engine.
20
- * `mcp` turns redact on unless `--no-redact` is set.
20
+ * `mcp` turns redact on unless `--no-redact` is set. `note` gets a line for
21
+ * stderr when a flag will not do what its name suggests.
21
22
  */
22
- export declare const pluginsFor: (flags: PluginFlags, mcp: boolean) => Promise<OutboundPlugin[]>;
23
+ export declare const pluginsFor: (flags: PluginFlags, mcp: boolean, note: (text: string) => void) => Promise<OutboundPlugin[]>;
@@ -0,0 +1,50 @@
1
+ import type { Json, JsonObject } from "../internal/json.ts";
2
+ import type { OutboundPlugin } from "../internal/outbound/plugins.ts";
3
+ /** How much of what was asked an answer covers. */
4
+ export interface Coverage {
5
+ /** `true` all of it, `false` part of it (`notes` says why). */
6
+ readonly complete: boolean;
7
+ readonly notes: readonly string[];
8
+ }
9
+ /** An answer with what the JSON itself cannot carry: whether `--limit` cut a list. */
10
+ export declare class Answer {
11
+ readonly value: Json;
12
+ readonly coverage: Coverage;
13
+ /** `true` for a list, which the envelope puts in `data.items`. */
14
+ readonly list: boolean;
15
+ constructor(value: Json, coverage: Coverage, list?: boolean);
16
+ /** How many records a list holds; 0 for an answer that is not a list. */
17
+ get size(): number;
18
+ }
19
+ /** What a command printed, as the printer receives it. */
20
+ export type Printed = Json | Answer;
21
+ export declare const valueOf: (printed: Printed) => Json;
22
+ /**
23
+ * What the answer says about its own coverage: a tool result, record, stats,
24
+ * thread or insight says it in its `meta`. A failed tool result is not
25
+ * complete. An answer with no `meta`, such as `capabilities` or `tools`, is
26
+ * read in full, so it is complete.
27
+ */
28
+ export declare const coverageOf: (printed: Printed) => Coverage;
29
+ /** Several sections printed together, keyed by name: complete only when each is. */
30
+ export declare const sections: (entries: readonly (readonly [string, Printed])[]) => Answer;
31
+ /** What the run knows besides the answer. */
32
+ export interface RunFacts {
33
+ /** The adapter's id, or `null` before one was chosen. */
34
+ readonly provider: string | null;
35
+ /** Vendor requests the command sent. */
36
+ readonly requests: number;
37
+ }
38
+ /** Counts every vendor request the command sends, for `meta.requests`. */
39
+ export declare const requestCounter: () => OutboundPlugin & {
40
+ readonly sent: () => number;
41
+ };
42
+ /** The answer in the envelope. */
43
+ export declare const envelope: (printed: Printed, facts: RunFacts) => JsonObject;
44
+ /** Why a command failed: the code and message stderr prints. */
45
+ export interface Failure {
46
+ readonly code: string;
47
+ readonly message: string;
48
+ }
49
+ /** A command that threw, in the envelope. stderr still gets the one-line reason. */
50
+ export declare const failedEnvelope: (failure: Failure, facts: RunFacts) => JsonObject;
@@ -1,4 +1,5 @@
1
1
  import type { Adapter } from "../internal/adapter.ts";
2
+ import type { OutboundOptions } from "../internal/outbound/outbound.ts";
2
3
  export { defineConfig } from "./config.ts";
3
4
  export type { CliConfig } from "./config.ts";
4
5
  export { createMcpServer, PROTOCOL_VERSIONS } from "./mcp.ts";
@@ -13,8 +14,12 @@ export interface CliIo {
13
14
  readonly stdin?: (() => AsyncIterable<string> | Iterable<string>) | undefined;
14
15
  /** Replaces the adapter the environment would choose. Meant for tests. */
15
16
  readonly adapter?: Adapter | undefined;
17
+ /** Replaces the `fetch` vendor requests are sent with. Meant for tests. */
18
+ readonly fetch?: OutboundOptions["fetch"];
16
19
  /** Runs npm for `outbound update` and resolves to its output. Meant for tests. */
17
20
  readonly npm?: ((args: readonly string[]) => Promise<string>) | undefined;
21
+ /** Waits between `outbound update` install retries. Meant for tests. */
22
+ readonly sleep?: ((ms: number) => Promise<void>) | undefined;
18
23
  }
19
24
  /** Runs the CLI. Returns the process exit code. */
20
25
  export declare const run: (argv: readonly string[], io: CliIo) => Promise<number>;
package/dist/cli/index.js CHANGED
@@ -4,27 +4,27 @@ import {
4
4
  defineConfig,
5
5
  run,
6
6
  serveStdio
7
- } from "../chunks/chunk-3JOC5DGD.js";
8
- import "../chunks/chunk-OLPMBRXM.js";
9
- import "../chunks/chunk-BK5SLY32.js";
10
- import "../chunks/chunk-HWHI4LFY.js";
7
+ } from "../chunks/chunk-6NSCPTOY.js";
8
+ import "../chunks/chunk-GL7BABF2.js";
9
+ import "../chunks/chunk-JRL3QRBS.js";
10
+ import "../chunks/chunk-4AVYRVN5.js";
11
11
  import "../chunks/chunk-4PA526S7.js";
12
12
  import "../chunks/chunk-HZCTYL22.js";
13
- import "../chunks/chunk-YYCT3NGV.js";
13
+ import "../chunks/chunk-65YAGEWZ.js";
14
14
  import "../chunks/chunk-4O2HRTTI.js";
15
15
  import "../chunks/chunk-HPNGSG5E.js";
16
- import "../chunks/chunk-ZOAG2C6V.js";
16
+ import "../chunks/chunk-HIAK2GCI.js";
17
17
  import "../chunks/chunk-PTZO4QXR.js";
18
- import "../chunks/chunk-BOWXGMN3.js";
19
- import "../chunks/chunk-PQSTQKRD.js";
18
+ import "../chunks/chunk-POBAY3TI.js";
19
+ import "../chunks/chunk-M2VXGLLZ.js";
20
20
  import "../chunks/chunk-QGRZDTX4.js";
21
- import "../chunks/chunk-QAKJ76HB.js";
21
+ import "../chunks/chunk-YW6FFVSZ.js";
22
22
  import "../chunks/chunk-NAWZ73QS.js";
23
23
  import "../chunks/chunk-FHKSLCVW.js";
24
- import "../chunks/chunk-UWUPUMM2.js";
25
- import "../chunks/chunk-GFDNRWR3.js";
26
- import "../chunks/chunk-J7DDZ4C2.js";
27
- import "../chunks/chunk-BLCJHP5H.js";
24
+ import "../chunks/chunk-MW4C6LTN.js";
25
+ import "../chunks/chunk-UFQ4WMLU.js";
26
+ import "../chunks/chunk-QFC4ZHD3.js";
27
+ import "../chunks/chunk-45TXPJW7.js";
28
28
  import "../chunks/chunk-WH6V3YNN.js";
29
29
  export {
30
30
  PROTOCOL_VERSIONS,
@@ -0,0 +1,13 @@
1
+ import type { Reply } from "../internal/entities.ts";
2
+ import type { ListAll } from "../internal/outbound/api.ts";
3
+ import { Answer } from "./envelope.ts";
4
+ export declare const listing: <Item>(walk: ListAll<Item>, input: {
5
+ readonly note: (text: string) => void;
6
+ }, one: string, many?: string) => Promise<Answer>;
7
+ /**
8
+ * Replies, one record per message or, `byPerson`, one row per person. A note
9
+ * says how many people sent them, since each record is a message.
10
+ */
11
+ export declare const listedReplies: (walk: ListAll<Reply>, input: {
12
+ readonly note: (text: string) => void;
13
+ }, byPerson: boolean) => Promise<Answer>;
@@ -0,0 +1,4 @@
1
+ import type { Json } from "../internal/json.ts";
2
+ import type { OutboundApi } from "../internal/outbound/api.ts";
3
+ /** Runs the native read `name` with the parameters `params` gives, once the name is known. */
4
+ export declare const readNative: (outbound: OutboundApi, name: string, params: () => Json) => Promise<Json>;