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,11 +1,11 @@
1
1
  import {
2
2
  fromOne,
3
3
  variantKey
4
- } from "./chunk-MGR6HREO.js";
4
+ } from "./chunk-BNDHEDHD.js";
5
5
  import {
6
6
  eventData,
7
7
  refTo
8
- } from "./chunk-2D42TQFU.js";
8
+ } from "./chunk-LVZGIKNF.js";
9
9
  import {
10
10
  SCHEMA_VERSION
11
11
  } from "./chunk-QGRZDTX4.js";
@@ -19,7 +19,7 @@ import {
19
19
  isString,
20
20
  text,
21
21
  timestamp
22
- } from "./chunk-BLCJHP5H.js";
22
+ } from "./chunk-45TXPJW7.js";
23
23
 
24
24
  // src/instantly/webhooks.ts
25
25
  var EVENT_TYPES = /* @__PURE__ */ new Map([
@@ -6,12 +6,12 @@ import {
6
6
  } from "./chunk-FHKSLCVW.js";
7
7
  import {
8
8
  OutboundError
9
- } from "./chunk-J7DDZ4C2.js";
9
+ } from "./chunk-QFC4ZHD3.js";
10
10
  import {
11
11
  count,
12
12
  isJsonArray,
13
13
  isJsonObject
14
- } from "./chunk-BLCJHP5H.js";
14
+ } from "./chunk-45TXPJW7.js";
15
15
 
16
16
  // src/internal/sequence.ts
17
17
  var variantKey = (index) => String.fromCodePoint(65 + index);
@@ -0,0 +1,81 @@
1
+ import {
2
+ OutboundError
3
+ } from "./chunk-QFC4ZHD3.js";
4
+
5
+ // src/internal/tracking.ts
6
+ var recorded = (campaign, metric) => (metric === "opens" ? campaign.opened : campaign.clicked) ?? 0;
7
+ var stateOf = (flags) => {
8
+ if (flags.every(Boolean)) {
9
+ return "on";
10
+ }
11
+ return flags.some(Boolean) ? "mixed" : "off";
12
+ };
13
+ var judge = (campaigns, metric) => {
14
+ const sending = campaigns.filter((campaign) => campaign.sent !== 0);
15
+ const flags = sending.map((campaign) => campaign.flags[metric]);
16
+ if (flags.length === 0 || flags.some((flag) => flag === null)) {
17
+ return null;
18
+ }
19
+ return {
20
+ measured: sending.every(
21
+ (campaign) => campaign.flags[metric] === true || recorded(campaign, metric) > 0
22
+ ),
23
+ state: stateOf(flags.filter((flag) => flag !== null))
24
+ };
25
+ };
26
+ var sumOf = (values) => {
27
+ let total = null;
28
+ for (const value of values) {
29
+ if (value !== null && value !== void 0) {
30
+ total = (total ?? 0) + value;
31
+ }
32
+ }
33
+ return total;
34
+ };
35
+ var ownTracking = (flags, rows) => ({
36
+ clicked: sumOf(rows.flatMap((row) => [row.clicked, row.clickedTotal])),
37
+ flags,
38
+ opened: sumOf(rows.flatMap((row) => [row.opened, row.openedTotal])),
39
+ sent: null
40
+ });
41
+ var unmeasured = (verdict) => verdict !== null && !verdict.measured;
42
+ var applyTracking = (rows, campaigns) => {
43
+ if (campaigns === null) {
44
+ return [...rows];
45
+ }
46
+ const opens = judge(campaigns, "opens");
47
+ const clicks = judge(campaigns, "clicks");
48
+ if (opens === null && clicks === null) {
49
+ return [...rows];
50
+ }
51
+ const tracking = {
52
+ clicks: clicks?.state ?? null,
53
+ opens: opens?.state ?? null
54
+ };
55
+ const noOpens = unmeasured(opens);
56
+ const noClicks = unmeasured(clicks);
57
+ return rows.map((row) => ({
58
+ ...row,
59
+ clicked: noClicks ? null : row.clicked,
60
+ clickedTotal: noClicks ? null : row.clickedTotal,
61
+ opened: noOpens ? null : row.opened,
62
+ openedTotal: noOpens ? null : row.openedTotal,
63
+ tracking
64
+ }));
65
+ };
66
+ var unlessFailed = async (read) => {
67
+ try {
68
+ return await read();
69
+ } catch (error) {
70
+ if (error instanceof OutboundError) {
71
+ return null;
72
+ }
73
+ throw error;
74
+ }
75
+ };
76
+
77
+ export {
78
+ ownTracking,
79
+ applyTracking,
80
+ unlessFailed
81
+ };
@@ -51,5 +51,6 @@ var normalizeBody = (body, includeBody) => {
51
51
  export {
52
52
  looksLikeHtml,
53
53
  htmlToText,
54
+ stripQuotedHistory,
54
55
  normalizeBody
55
56
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createTools
3
- } from "./chunk-BK5SLY32.js";
3
+ } from "./chunk-JRL3QRBS.js";
4
4
  import {
5
5
  parseJson
6
- } from "./chunk-BLCJHP5H.js";
6
+ } from "./chunk-45TXPJW7.js";
7
7
 
8
8
  // src/tools/index.ts
9
9
  var toFunction = (tool) => ({
@@ -11,10 +11,10 @@ import {
11
11
  senderSchema,
12
12
  sequenceSchema,
13
13
  workspaceSchema
14
- } from "./chunk-BOWXGMN3.js";
14
+ } from "./chunk-POBAY3TI.js";
15
15
  import {
16
16
  OutboundError
17
- } from "./chunk-J7DDZ4C2.js";
17
+ } from "./chunk-QFC4ZHD3.js";
18
18
 
19
19
  // src/internal/capabilities.ts
20
20
  var NO_CAPABILITIES = {
@@ -27,6 +27,7 @@ var NO_CAPABILITIES = {
27
27
  "events.parse": false,
28
28
  "events.verify": false,
29
29
  "leads.byCampaign": false,
30
+ "leads.byDomain": false,
30
31
  "leads.engagement": false,
31
32
  "leads.get": false,
32
33
  "leads.list": false,
@@ -163,6 +164,12 @@ var campaignProgressSchema = z.object({
163
164
  leads: count,
164
165
  /** Leads still waiting for their first step. */
165
166
  notStarted: count,
167
+ /**
168
+ * Leads the vendor decided never to send to, for example ones an exclusion
169
+ * rule kept out. Optional, so progress built or stored before the field
170
+ * existed still matches the schema.
171
+ */
172
+ skipped: count.optional(),
166
173
  /** Leads taken out of the sequence before its end. */
167
174
  stopped: count
168
175
  });
@@ -1,17 +1,20 @@
1
+ import {
2
+ detectAutoReply
3
+ } from "./chunk-OK3GAZMT.js";
1
4
  import {
2
5
  createVendorClient,
3
6
  leadStanding,
4
7
  listIn
5
- } from "./chunk-MGR6HREO.js";
8
+ } from "./chunk-BNDHEDHD.js";
6
9
  import {
7
10
  normalizeBody
8
- } from "./chunk-53DCVFUB.js";
11
+ } from "./chunk-FALWG5U3.js";
9
12
  import {
10
13
  eventData,
11
14
  eventTypesOf,
12
15
  recordBase,
13
16
  refTo
14
- } from "./chunk-2D42TQFU.js";
17
+ } from "./chunk-LVZGIKNF.js";
15
18
  import {
16
19
  SCHEMA_VERSION
17
20
  } from "./chunk-QGRZDTX4.js";
@@ -20,7 +23,7 @@ import {
20
23
  } from "./chunk-FHKSLCVW.js";
21
24
  import {
22
25
  requireObject
23
- } from "./chunk-J7DDZ4C2.js";
26
+ } from "./chunk-QFC4ZHD3.js";
24
27
  import {
25
28
  count,
26
29
  emailAddress,
@@ -34,7 +37,7 @@ import {
34
37
  text,
35
38
  timestamp,
36
39
  withoutKeys
37
- } from "./chunk-BLCJHP5H.js";
40
+ } from "./chunk-45TXPJW7.js";
38
41
 
39
42
  // src/emailbison/capabilities.ts
40
43
  var BASE_URL = "https://dedi.emailbison.com";
@@ -125,25 +128,43 @@ var fields = {
125
128
  linkedinUrl: false,
126
129
  location: false,
127
130
  phone: false,
131
+ recipientMailProvider: false,
128
132
  tags: false,
129
133
  website: false
130
134
  },
131
135
  // A sent email names its step by id, not by place.
132
- message: { stepIndex: false, variantKey: false },
136
+ // A message is not marked automatic; a reply is.
137
+ message: {
138
+ isAuto: false,
139
+ isAutoSource: false,
140
+ stepIndex: false,
141
+ variantKey: false
142
+ },
133
143
  metricRow: {
134
144
  clicked: false,
135
145
  clickedTotal: false,
146
+ completed: false,
136
147
  connectionsAccepted: false,
137
148
  connectionsSent: false,
138
149
  contentHash: false,
139
150
  delivered: false,
140
151
  inmailsSent: false,
152
+ leads: false,
153
+ opportunities: false,
154
+ opportunityValue: false,
155
+ repliedAutoTotal: false,
156
+ repliedTotal: false,
141
157
  repliedAuto: false,
142
158
  // No read says which timezone its days are in.
143
159
  timezone: false
144
160
  },
145
161
  placementTest: false,
146
- reply: { stepIndex: false, variantKey: false },
162
+ reply: {
163
+ // A fixed rule reads the sender, subject and body when automated_reply is missing.
164
+ leftCompany: "derived",
165
+ stepIndex: false,
166
+ variantKey: false
167
+ },
147
168
  sender: { linkedinUrl: false },
148
169
  // Only the main sequence is read, and it has no name.
149
170
  sequence: { name: false },
@@ -182,7 +203,8 @@ var costs = {
182
203
  "senders.list": { pageSize: PAGE_SIZE, perPage: 1 },
183
204
  "sequence.get": { perPage: 1 },
184
205
  // Step rows cost two: the campaign's stats, then its steps.
185
- stats: { perPage: 1 },
206
+ // A campaign or its steps add the campaign, for its open tracking.
207
+ stats: { perPage: 1, perPageAtMost: 3 },
186
208
  "tags.list": { perPage: 1 },
187
209
  "webhooks.list": { pageSize: PAGE_SIZE, perPage: 1 },
188
210
  "workspaces.list": { perPage: 1 }
@@ -324,12 +346,20 @@ var categoryOf = (raw) => {
324
346
  var toReply = (identity, raw, includeBody) => {
325
347
  const category = categoryOf(raw);
326
348
  const read = flag(raw.read);
349
+ const vendor = flag(raw.automated_reply);
350
+ const verdict = detectAutoReply({
351
+ body: bodyOf(raw),
352
+ from: text(raw.from_email_address),
353
+ subject: text(raw.subject) ?? text(raw.email_subject)
354
+ });
327
355
  return {
328
356
  ...inboxFields(identity, raw, includeBody),
329
357
  category,
330
358
  categorySource: category === "unknown" ? null : "vendor",
331
359
  direction: "in",
332
- isAuto: flag(raw.automated_reply),
360
+ isAuto: vendor ?? verdict.isAuto,
361
+ isAutoSource: vendor === null ? "rule" : "vendor",
362
+ leftCompany: verdict.leftCompany,
333
363
  unread: read === null ? null : !read
334
364
  };
335
365
  };
@@ -494,6 +524,7 @@ var toLead = (identity, raw, campaignId = null) => {
494
524
  linkedinUrl: null,
495
525
  location: null,
496
526
  phone: null,
527
+ recipientMailProvider: null,
497
528
  tags: [],
498
529
  title: text(raw.title),
499
530
  website: null