outbound-sdk 0.7.1 → 0.9.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 (120) hide show
  1. package/dist/alerts/index.js +3 -3
  2. package/dist/audit/index.js +1 -1
  3. package/dist/benchmarks/index.js +3 -3
  4. package/dist/budget/index.d.ts +7 -0
  5. package/dist/budget/index.js +3 -3
  6. package/dist/cache/index.js +2 -2
  7. package/dist/cards/index.js +17 -5
  8. package/dist/chunks/{chunk-6NSCPTOY.js → chunk-4BH5LRCS.js} +691 -441
  9. package/dist/chunks/{chunk-MW4C6LTN.js → chunk-5XLR6XVV.js} +2 -2
  10. package/dist/chunks/{chunk-HIAK2GCI.js → chunk-A7DLJUA6.js} +6 -1
  11. package/dist/chunks/{chunk-M2VXGLLZ.js → chunk-CPACP4YD.js} +1 -1
  12. package/dist/chunks/{chunk-4AVYRVN5.js → chunk-FTK4JS65.js} +31 -10
  13. package/dist/chunks/{chunk-YW6FFVSZ.js → chunk-HXB2IOJJ.js} +1 -1
  14. package/dist/chunks/{chunk-FHKSLCVW.js → chunk-KVAG5GM2.js} +19 -0
  15. package/dist/chunks/{chunk-65YAGEWZ.js → chunk-MEEJIIIA.js} +178 -39
  16. package/dist/chunks/{chunk-7I3EPR23.js → chunk-MPE6VLLY.js} +3 -3
  17. package/dist/chunks/{chunk-UFQ4WMLU.js → chunk-NFWWA7MI.js} +1 -1
  18. package/dist/chunks/{chunk-GL7BABF2.js → chunk-OMCDMELK.js} +1 -1
  19. package/dist/chunks/{chunk-JRL3QRBS.js → chunk-OVTYA3IB.js} +88 -28
  20. package/dist/chunks/{chunk-T5MJMW3R.js → chunk-QTWJ5FO7.js} +1 -1
  21. package/dist/chunks/chunk-REDFBY74.js +7285 -0
  22. package/dist/chunks/{chunk-OK3GAZMT.js → chunk-SYUMA3CP.js} +12 -0
  23. package/dist/chunks/{chunk-LVZGIKNF.js → chunk-U5AK6OJM.js} +1 -1
  24. package/dist/chunks/{chunk-KTYTE2BU.js → chunk-UAHYPASH.js} +20 -11
  25. package/dist/chunks/{chunk-BNDHEDHD.js → chunk-UOJG4VYF.js} +3 -3
  26. package/dist/chunks/{chunk-LD6F46UT.js → chunk-UWD65SK7.js} +2 -2
  27. package/dist/chunks/{chunk-I7DXXGNZ.js → chunk-UZLFZZ2U.js} +5 -5
  28. package/dist/chunks/{chunk-DNPNTD5W.js → chunk-VVDBCQLK.js} +1 -1
  29. package/dist/chunks/{chunk-IVH3NMQZ.js → chunk-WROJO6XB.js} +1 -1
  30. package/dist/chunks/{chunk-QFC4ZHD3.js → chunk-XYHM4KHC.js} +1 -1
  31. package/dist/chunks/{chunk-NAWZ73QS.js → chunk-YFJ3OQZS.js} +8 -1
  32. package/dist/chunks/tools-ATY622UC.js +23 -0
  33. package/dist/cli/args.d.ts +48 -0
  34. package/dist/cli/bin.js +14 -14
  35. package/dist/cli/commands.d.ts +0 -7
  36. package/dist/cli/config.d.ts +31 -2
  37. package/dist/cli/envelope.d.ts +2 -0
  38. package/dist/cli/index.d.ts +4 -0
  39. package/dist/cli/index.js +19 -15
  40. package/dist/cli/listing.d.ts +5 -2
  41. package/dist/cli/mcp.d.ts +9 -0
  42. package/dist/cli/offered.d.ts +10 -0
  43. package/dist/cli/options.d.ts +6 -0
  44. package/dist/cli/progress.d.ts +27 -0
  45. package/dist/cli/serve.d.ts +17 -0
  46. package/dist/clients/index.js +3 -3
  47. package/dist/combine/index.js +154 -35
  48. package/dist/combine/newest.d.ts +18 -0
  49. package/dist/combine/route.d.ts +19 -5
  50. package/dist/emailbison/index.js +22 -14
  51. package/dist/emailbison/map-sequence.d.ts +2 -1
  52. package/dist/exporter/index.js +1 -1
  53. package/dist/failover/index.js +3 -3
  54. package/dist/fixtures/index.js +4 -4
  55. package/dist/heyreach/capabilities.d.ts +4 -0
  56. package/dist/heyreach/conversations.d.ts +23 -0
  57. package/dist/heyreach/inbox.d.ts +0 -1
  58. package/dist/heyreach/index.js +251 -92
  59. package/dist/identity/index.js +2 -2
  60. package/dist/index.js +7 -7
  61. package/dist/insights/capped.d.ts +6 -6
  62. package/dist/insights/copy/index.d.ts +2 -0
  63. package/dist/insights/copy/reply-timing.d.ts +4 -0
  64. package/dist/insights/cost.d.ts +11 -1
  65. package/dist/insights/define.d.ts +25 -16
  66. package/dist/insights/inbox.d.ts +12 -0
  67. package/dist/insights/index.js +42 -6578
  68. package/dist/insights/inputs.generated.d.ts +62 -26
  69. package/dist/insights/ops/anomalies.d.ts +9 -0
  70. package/dist/insights/ops/index.d.ts +2 -0
  71. package/dist/insights/ops/period-comparison.d.ts +7 -8
  72. package/dist/insights/ops/pipeline-forecast.d.ts +16 -0
  73. package/dist/insights/ops/shared.d.ts +6 -1
  74. package/dist/insights/people/auto-replies.d.ts +11 -7
  75. package/dist/insights/people/dropped-replies.d.ts +13 -4
  76. package/dist/insights/people/hot-leads-read.d.ts +31 -0
  77. package/dist/insights/people/hot-leads.d.ts +15 -3
  78. package/dist/insights/people/index.d.ts +10 -2
  79. package/dist/insights/people/read.d.ts +1 -1
  80. package/dist/insights/registry.d.ts +14 -2
  81. package/dist/insights/run-cap.d.ts +10 -0
  82. package/dist/insights/senders/read.d.ts +0 -3
  83. package/dist/insights/tools.d.ts +12 -0
  84. package/dist/insights/tracked-reads.d.ts +53 -0
  85. package/dist/instantly/capabilities.d.ts +13 -1
  86. package/dist/instantly/index.js +128 -46
  87. package/dist/instantly/map-account.d.ts +2 -1
  88. package/dist/instantly/map-lead.d.ts +1 -0
  89. package/dist/instantly/map.d.ts +4 -3
  90. package/dist/internal/adapter.d.ts +19 -0
  91. package/dist/internal/capabilities.d.ts +15 -0
  92. package/dist/internal/engine/budget.d.ts +9 -1
  93. package/dist/internal/engine/engine.d.ts +2 -1
  94. package/dist/internal/engine/request.d.ts +2 -0
  95. package/dist/internal/errors.d.ts +5 -0
  96. package/dist/internal/hooks.d.ts +11 -0
  97. package/dist/internal/notes.d.ts +16 -0
  98. package/dist/internal/outbound/api.d.ts +16 -0
  99. package/dist/internal/outbound/core.d.ts +4 -1
  100. package/dist/internal/outbound/operation-shared.d.ts +2 -0
  101. package/dist/internal/sha256.d.ts +2 -0
  102. package/dist/internal/url.d.ts +1 -0
  103. package/dist/loader/index.js +3 -3
  104. package/dist/memory/index.js +11 -16
  105. package/dist/redact/index.d.ts +1 -1
  106. package/dist/redact/index.js +107 -19
  107. package/dist/redact/plugin.d.ts +26 -3
  108. package/dist/smartlead/index.js +22 -13
  109. package/dist/smartlead/map.d.ts +3 -2
  110. package/dist/sync/index.js +2 -2
  111. package/dist/tools/ai-sdk.js +5 -5
  112. package/dist/tools/by-name.d.ts +9 -1
  113. package/dist/tools/campaign-tools.d.ts +3 -1
  114. package/dist/tools/claude-agent.js +5 -5
  115. package/dist/tools/index.js +6 -6
  116. package/dist/tools/registry.d.ts +6 -0
  117. package/dist/tools/shared.d.ts +5 -1
  118. package/dist/tracing/index.js +1 -1
  119. package/dist/webhooks/index.js +11 -11
  120. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  fromOne,
3
3
  variantKey
4
- } from "./chunk-BNDHEDHD.js";
4
+ } from "./chunk-UOJG4VYF.js";
5
5
  import {
6
6
  eventData,
7
7
  refTo
8
- } from "./chunk-LVZGIKNF.js";
8
+ } from "./chunk-U5AK6OJM.js";
9
9
  import {
10
10
  SCHEMA_VERSION
11
11
  } from "./chunk-QGRZDTX4.js";
12
12
  import {
13
13
  stableId
14
- } from "./chunk-FHKSLCVW.js";
14
+ } from "./chunk-KVAG5GM2.js";
15
15
  import {
16
16
  emailAddress,
17
17
  flag,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OutboundError
3
- } from "./chunk-QFC4ZHD3.js";
3
+ } from "./chunk-XYHM4KHC.js";
4
4
 
5
5
  // src/internal/env.ts
6
6
  var readEnv = (name) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createTools
3
- } from "./chunk-JRL3QRBS.js";
3
+ } from "./chunk-OVTYA3IB.js";
4
4
  import {
5
5
  parseJson
6
6
  } from "./chunk-45TXPJW7.js";
@@ -16,7 +16,7 @@ import {
16
16
  untrusted,
17
17
  weakest,
18
18
  withCampaign
19
- } from "./chunk-4AVYRVN5.js";
19
+ } from "./chunk-FTK4JS65.js";
20
20
  import {
21
21
  plural as plural2
22
22
  } from "./chunk-4PA526S7.js";
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-QGRZDTX4.js";
37
37
  import {
38
38
  OutboundError
39
- } from "./chunk-QFC4ZHD3.js";
39
+ } from "./chunk-XYHM4KHC.js";
40
40
  import {
41
41
  jsonInput,
42
42
  toJson,
@@ -76,7 +76,7 @@ var campaignSetup = {
76
76
  meta: {
77
77
  complete: settings.meta.complete,
78
78
  evidence: settings.meta.evidence,
79
- notes: [],
79
+ notes: [...settings.meta.notes],
80
80
  provider: outbound.provider,
81
81
  requests: settings.meta.requests
82
82
  },
@@ -235,7 +235,7 @@ var vendorRead = {
235
235
  meta: {
236
236
  complete: result.meta.complete,
237
237
  evidence: result.meta.evidence,
238
- notes: [],
238
+ notes: [...result.meta.notes],
239
239
  provider: outbound.provider,
240
240
  requests: result.meta.requests
241
241
  },
@@ -331,23 +331,46 @@ var repliesByPerson = (replies) => {
331
331
  // src/tools/campaign-tools.ts
332
332
  var overviewInput = z2.object({
333
333
  ...optionalRange,
334
+ campaign: z2.string().min(1).optional().describe(
335
+ "One campaign's ref, id or name, to read only it; status and limit are then not used. Leave out for every campaign with the status"
336
+ ),
334
337
  limit: z2.number().int().min(1).max(50).default(10).describe("How many campaigns to include"),
335
338
  status: campaignStatusSchema.default("active").describe("Which campaigns to include")
336
339
  });
340
+ var readOverview = async (outbound, input) => {
341
+ if (input.campaign !== void 0) {
342
+ const campaign = await outbound.campaign(input.campaign).get();
343
+ return {
344
+ campaigns: [campaign],
345
+ requests: campaign.meta.requests,
346
+ truncated: false
347
+ };
348
+ }
349
+ const walk = outbound.campaigns.listAll({
350
+ max: input.limit,
351
+ status: input.status
352
+ });
353
+ const campaigns = await walk.toArray();
354
+ return {
355
+ campaigns,
356
+ requests: walk.meta?.requests ?? 0,
357
+ truncated: walk.truncated
358
+ };
359
+ };
337
360
  var campaignOverview = {
338
- description: "How every campaign is doing right now: sends, replies, positive replies, bounces and reply rate for each campaign with the given status. One vendor request per campaign. Rates are computed from counts; a null means the vendor does not report that count. meta.complete: false means limit cut the list, and meta.notes says so.",
361
+ description: "How every campaign is doing right now: sends, replies, positive replies, bounces and reply rate for each campaign with the given status, or for the one campaign given. One vendor request per campaign. Rates are computed from counts; a null means the vendor does not report that count. meta.complete: false means limit cut the list, and meta.notes says so.",
339
362
  inputSchema: overviewInput,
340
363
  name: "campaign_overview",
341
364
  needs: ["campaigns.status", "stats.campaign"],
342
365
  run: async (outbound, input) => {
343
- const walk = outbound.campaigns.listAll({
344
- max: input.limit,
345
- status: input.status
346
- });
347
- const campaigns = await walk.toArray();
366
+ const {
367
+ campaigns,
368
+ requests: listed,
369
+ truncated
370
+ } = await readOverview(outbound, input);
348
371
  const rows = [];
349
372
  const evidence = [];
350
- let requests = walk.meta?.requests ?? 0;
373
+ let requests = listed;
351
374
  const read = await mapConcurrent(campaigns, async (campaign) => ({
352
375
  campaign,
353
376
  stats: await outbound.campaign(campaign.ref).stats({ from: input.from, to: input.to })
@@ -367,9 +390,9 @@ var campaignOverview = {
367
390
  return {
368
391
  data: { campaigns: rows },
369
392
  meta: {
370
- complete: !walk.truncated,
393
+ complete: !truncated,
371
394
  evidence: weakest(evidence),
372
- notes: walk.truncated ? [
395
+ notes: truncated ? [
373
396
  `Stopped at ${plural2(rows.length, "campaign")} (limit); more ${input.status} campaigns exist.`
374
397
  ] : [],
375
398
  provider: outbound.provider,
@@ -432,7 +455,7 @@ var campaignTrend = {
432
455
  meta: {
433
456
  complete: stats.meta.complete,
434
457
  evidence: stats.meta.evidence,
435
- notes: [],
458
+ notes: [...stats.meta.notes],
436
459
  provider: outbound.provider,
437
460
  requests: stats.meta.requests
438
461
  },
@@ -486,7 +509,7 @@ var winningSteps = {
486
509
  meta: {
487
510
  complete: stats.meta.complete,
488
511
  evidence: stats.meta.evidence,
489
- notes: [],
512
+ notes: [...stats.meta.notes],
490
513
  provider: outbound.provider,
491
514
  requests: stats.meta.requests
492
515
  },
@@ -512,6 +535,7 @@ var senderHealth = {
512
535
  const senders = await walk.toArray();
513
536
  const cut = walk.truncated || senders.length > input.limit;
514
537
  const notes = [
538
+ ...walk.meta?.notes ?? [],
515
539
  ...walk.truncated ? [
516
540
  `More senders exist than the ${senders.length} checked; unhealthy counts only those.`
517
541
  ] : [],
@@ -864,6 +888,53 @@ var withOfferedHints = (tool, offered) => {
864
888
  }
865
889
  };
866
890
  };
891
+ var pluginsOf = (outbound) => /* @__PURE__ */ new Map([
892
+ ["clients", "clients" in outbound],
893
+ // person() refuses when redact masks the identifiers it links by.
894
+ ["identity", "person" in outbound && !masksIdentifiers(outbound)],
895
+ // Offered only when the vendor has reads of its own and no plugin turned them off.
896
+ [
897
+ "native",
898
+ outbound.capabilities.native && Object.keys(outbound.native.catalog).length > 0
899
+ ]
900
+ ]);
901
+ var metOn = (outbound) => {
902
+ const added = pluginsOf(outbound);
903
+ const { capabilities } = outbound;
904
+ const isCapability = (need) => Object.hasOwn(capabilities, need);
905
+ return (need) => added.get(need) ?? (isCapability(need) && capabilities[need] !== false);
906
+ };
907
+ var NEEDS = new Map(
908
+ [
909
+ campaignOverview,
910
+ campaignTrend,
911
+ winningSteps,
912
+ senderHealth,
913
+ replySamples,
914
+ leadRunway,
915
+ compareClients,
916
+ crossChannelLead,
917
+ campaignSetup,
918
+ deliverabilityCheck,
919
+ audienceLists,
920
+ vendorRead
921
+ ].map((definition) => [definition.name, definition.needs])
922
+ );
923
+ var leftOutReason = (outbound, name) => {
924
+ const met = metOn(outbound);
925
+ const unmet = (NEEDS.get(name) ?? []).filter((need) => !met(need));
926
+ if (unmet.length === 0) {
927
+ return void 0;
928
+ }
929
+ const plugins = unmet.filter((need) => pluginsOf(outbound).has(need));
930
+ const capabilities = unmet.filter((need) => !plugins.includes(need));
931
+ return `${name} is not available: ${[
932
+ ...capabilities.length > 0 ? [
933
+ `the ${outbound.provider} adapter does not support ${capabilities.join(", ")}`
934
+ ] : [],
935
+ ...plugins.length > 0 ? [`it needs ${plugins.join(", ")}, which this instance does not offer`] : []
936
+ ].join("; ")}`;
937
+ };
867
938
  var createTools = (outbound, options = {}) => {
868
939
  checkCap(options.maxRequestsPerToolCall, "maxRequestsPerToolCall");
869
940
  const all = [
@@ -881,19 +952,7 @@ var createTools = (outbound, options = {}) => {
881
952
  bind(outbound, vendorRead)
882
953
  ];
883
954
  const wanted = options.only === void 0 ? void 0 : new Set(options.only);
884
- const added = /* @__PURE__ */ new Map([
885
- ["clients", "clients" in outbound],
886
- // person() refuses when redact masks the identifiers it links by.
887
- ["identity", "person" in outbound && !masksIdentifiers(outbound)],
888
- // Offered only when the vendor has reads of its own and no plugin turned them off.
889
- [
890
- "native",
891
- outbound.capabilities.native && Object.keys(outbound.native.catalog).length > 0
892
- ]
893
- ]);
894
- const { capabilities } = outbound;
895
- const isCapability = (need) => Object.hasOwn(capabilities, need);
896
- const met = (need) => added.get(need) ?? (isCapability(need) && capabilities[need] !== false);
955
+ const met = metOn(outbound);
897
956
  const offered = [
898
957
  ...all.filter(
899
958
  (tool) => (wanted === void 0 || wanted.has(tool.name)) && tool.needs.every(met)
@@ -918,5 +977,6 @@ export {
918
977
  describeReplyCounts,
919
978
  repliesByPerson,
920
979
  TOOL_NAMES,
980
+ leftOutReason,
921
981
  createTools
922
982
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  run
3
- } from "./chunk-6NSCPTOY.js";
3
+ } from "./chunk-4BH5LRCS.js";
4
4
 
5
5
  // src/cli/bin.ts
6
6
  import process from "node:process";